由于ShouldAutorotateToInterfaceOrientation在iOS 6中已弃用并且我使用它来强制特定视图仅限于纵向,在iOS 6中执行此操作的正确方法是什么?这仅适用于我的应用的一个区域,所有其他视图都可以旋转.
我有iPhone应用程序,只支持纵向方向.我想添加到仅支持横向方向的项目视图控制器?可能吗?如果是的话我怎么能实现呢?
我试图像这样包装类别文件:
@implementation UINavigationController (Rotation_IOS7)
-(BOOL)shouldAutorotate
{
return YES;
}
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscape;
}
Run Code Online (Sandbox Code Playgroud)
如果我这样做,我会收到此错误:由于未捕获的异常而终止应用程序UIApplicationInvalidInterfaceOrientation,原因:Supported orientations has no common orientation with the application, and shouldAutorotate is returning YES