【发布时间】:2012-12-19 21:54:58
【问题描述】:
我的应用程序支持所有类型的方向,但是我希望某些 viewController 只支持横向,并且很少支持 Potrait 模式。 我该怎么做,我尝试了下面的代码,但没有任何效果。
- (BOOL)shouldAutorotate {
return NO;
}
- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskPortrait;
}
// pre-iOS 6 support
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
return (toInterfaceOrientation == UIInterfaceOrientationPortrait);
}
【问题讨论】:
-
什么不起作用?使用您发布的代码,控制器是否旋转景观?您提到的不同控制器是如何连接的?
-
通过导航控制器。控制器确实旋转到横向
标签: iphone objective-c ios cocoa-touch