【发布时间】:2013-05-02 08:50:37
【问题描述】:
我有一个场景,我正在动态创建UIViewcontrollers 并在其顶部添加一个 UIView 并将其推送到导航堆栈。这就是我创建 view Controller
UIViewController *vc = [UIViewController new];
[vc.view addSubView:customView];
[self.navigationController pushViewController vc];
在设备上运行我的应用程序时,我的视图不会自动旋转。 (如果 VC 有一个实现文件,我会在 shouldAutorotate 中返回 YES 以使其工作。)
任何指针/帮助表示赞赏。
根据乔治的回复编辑:
George 的代码完美适用于 ios6 及更高版本。 supportedInterfaceOrientations API 已为 ios6.0+ 提供,正在寻找 ios4.3+ 的一般修复
谢谢..
【问题讨论】:
-
"要支持其他方向,您必须重写 shouldAutorotateToInterfaceOrientation: 方法并为您的子类支持的任何方向返回 YES。如果您的视图的自动调整大小属性配置正确,那么您可能需要做的就是。” (c)developer.apple.com/library/ios/#documentation/UIKit/Reference/…
标签: iphone ios objective-c ipad uiviewcontroller