我无法理解iOS6中的旋转机制 [英] I can't understand rotation mechanism in iOS6

查看:115
本文介绍了我无法理解iOS6中的旋转机制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序有视图控制器子类化 shouldautorotateToInterfaceOrientation 。在其中,我决定每个视图的旋转。这工作正常。但在iOS6中,虽然我阅读了Apple提供的文档,但我无法理解。

My app has view controllers subclassing shouldautorotateToInterfaceOrientation. And in it, I decides each view's rotation. This works correctly. But in iOS6, though I read documents provided Apple, I can't understand it.

我的应用程序将导航控制器作为根视图控制器。该导航控制器具有标签控制器。标签控制器有一些视图控制器。我希望第一个视图控制器(在标签控制器中)仅作为纵向模式查看,第二个视图控制器(在标签控制器中)同时查看纵向和横向模式。它在iOS5中正常工作。
但我不知道如何在iOS6中制作它。虽然我知道我应该继承 supportedInterfaceOrientations ,但它在轮换发生时不起作用。令我惊讶的是,在显示视图时会调用它。
如何制作我想要的东西?

My app has navigation controller as root view controller. This navigation controller has tab controller. And the tab controller has some view controllers. I want the first view controller (in tab controller) viewed only as portrait mode and the second view controller (in tab controller) viewed both portrait and landscape mode. It works correctly in iOS5. But I don't know how to make it in iOS6. Although I know I should subclass supportedInterfaceOrientations, it doesn't work when rotation happen. To my surprise it is called when a view is showing. How to make what I want?

感谢您阅读。

推荐答案

以下链接可能会引导您走向正确的方向: http://code.shabz.co/post/32051014482/ios-6-supportedorientations-with-uinavigationcontroller

The following link might steer you to the right direction: http://code.shabz.co/post/32051014482/ios-6-supportedorientations-with-uinavigationcontroller

基本上,你需要子类UINavigationController让它监听 topViewController -supportedInterfaceOrientations 中的更改。您可以在博客文章中下载一个示例类,并说明要添加的代码。

Basically, you need to subclass UINavigationController and have it listen to changes in -supportedInterfaceOrientations of its topViewController. There is a sample class you can download in the blog post and also explains what code to add.

这篇关于我无法理解iOS6中的旋转机制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆