我有一個應用程序,它有2個視圖控制器。第一個viewcontroller應該是肖像,這是可以的,但是當我加載第二個視圖控制器時,我無法使應用程序方向爲風景...問題與iOS 6.第一個UIView縱向和第二個橫向
我已經嘗試了一切我在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]:http://stackoverflow.com/questions/15110838/xcode-how-但是仍然允許一個視圖/ 15112927#15112927 – Ushan87 2013-05-06 05:03:32