ios6从横向到纵向模式的旋转问题

ios6从横向到纵向模式的旋转问题

问题描述:

我正在使用ios 6的新定位方法,它工作正常。我的观点是以肖像模式呈现,当我呈现viewcotrnoller并将其旋转到风景时,请忽略该视图控制器它将恢复方向。意味着它应该保持在风景中,但它变成了肖像。 这是我的代码。ios6从横向到纵向模式的旋转问题

- (NSUInteger)supportedInterfaceOrientations { 
    return UIInterfaceOrientationMaskAll; 

} 

// Tell the system It should autorotate 
- (BOOL) shouldAutorotate { 
    return YES; 
} 

// Tell the system which initial orientation we want to have 
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation { 
    return UIInterfaceOrientationMaskPortrait; 
} 

我想是因为preferredInterfaceOrientationForPresentation方法的发生,但没有得到对this.Please帮助解决!

谢谢!

+0

什么是确切的问题btw?您只为preferredInterfaceOrientation设置了肖像。因此,只有我猜,控制器应该始终以肖像模式呈现。尝试UIInterfaceOrientationMaskAll并检查发生了什么。 – mayuur

+0

因未捕获异常'UIApplicationInvalidInterfaceOrientation'而终止应用程序,原因:'preferredInterfaceOrientationForPresentation必须返回受支持的界面方向!'它坠毁了 – iProgrammer

+2

我的不好。它接受一个UIInterfaceOrientation而不是一个Mask。顺便说一句,删除此方法的作品!反正用什么? – mayuur

如果你想在一开始支持的所有interfaceOrientations,不写preferredInterfaceOrientationForPresentation方法,因为它会采取仅仅是首选接口方向所有的时间。

+0

感谢您的回答:)这是工作 – iProgrammer