【发布时间】:2013-05-06 13:23:20
【问题描述】:
我有一个有 2 个视图控制器的应用程序。第一个视图控制器应该是纵向的,没关系,但是当我加载第二个视图控制器时,我无法将应用程序方向设置为横向......问题出在 iOS 6 上。
我已经尝试了我在 SO 上找到的所有内容。
在viewWillAppear 和viewDidLoad 上使用[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight animated:NO];,
还有:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if (interfaceOrientation == UIInterfaceOrientationPortrait) {
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
} else {
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
}
-(BOOL)shouldAutorotate
{
return YES;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationLandscapeRight;
}
-(NSInteger)supportedInterfaceOrientations{
return UIInterfaceOrientationMaskLandscapeRight;
}
【问题讨论】:
-
你有没有在 [这里] [1] 上尝试过我的答案:stackoverflow.com/questions/15110838/…
标签: iphone ios objective-c screen-orientation uiinterfaceorientation