因此,正如问题所示,我使用以下代码为视图控制器设置userinterfaceOrientation。
- (BOOL) shouldAutorotate
{
return YES;
}
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskPortrait;
}我尝试为另一个viewController设置UIInterfaceOrientationMaskAll。
之前,我检查了info-plist中的所有Supported interface orientations项。这两个viewControllers都返回了所有方向的true(在info-plist中设置),并且不遵循上面的代码。即使在没有上述代码的情况下,它也可以工作。有没有办法限制特定类的特定Supported interface orientations?通过遵循this link,我让它适用于iOS6之前的版本。
发布于 2012-09-26 20:56:27
我能够通过将我支持的定向逻辑放在自定义的UINavigationController中来实现这一点。然后,我转到相关的视图控制器。
@implementation PortraitNavigationController
- (NSUInteger)supportedInterfaceOrientations{
return UIInterfaceOrientationMaskPortrait;
}..。
发布于 2012-09-26 19:40:43
我要说的是,在每个视图控制器上实现你的shouldAutorotateToInterfaceOrientation:,让它只为你想支持的方向返回YES。
https://stackoverflow.com/questions/12600867
复制相似问题