【发布时间】:2012-10-11 08:51:42
【问题描述】:
我的应用中有一些我不想支持方向的视图。
在didFinishLaunchingWithOptions 我添加导航:
...
UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:self.viewController];
self.window.rootViewController = nav;
[self.window makeKeyAndVisible];
...
在每个ViewController 中我都有UITabBar(我不知道这是否重要)。
在我添加的第一个视图控制器中:
-(BOOL)shouldAutorotate {
return NO;
}
- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskPortrait;
}
supportedInterfaceOrientations 在视图加载时被调用,但shouldAutorotate 在我旋转设备时不会调用。
我在这里错过了什么?
【问题讨论】:
-
看看我的回答:stackoverflow.com/a/12893485/550177 有帮助吗?
标签: iphone objective-c ios ios6 uiinterfaceorientation