标签:
Xcode升级到7.0,iOS升级到9.0后,发现原来设置不旋转的方法失效了。在网上发现需要如下设置:
1. 在ViewController里面设置
/* iOS6后被废弃了,使用接下来的两个方法,并且要在Deloyment info勾上requires full screen */ - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return (interfaceOrientation == UIInterfaceOrientationPortrait); } /* 是否支持旋转 */ - (BOOL)shouldAutorotate { return NO; } /* 支持的方向 */ - (UIInterfaceOrientationMask)supportedInterfaceOrientations { return UIInterfaceOrientationMaskPortrait; } - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation { return UIInterfaceOrientationPortrait; }
2. 在AppDelegate插入
- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window { return UIInterfaceOrientationMaskPortrait; }
3. 在General里面勾上Requires full screen
标签:
原文地址:http://www.cnblogs.com/datou-mars/p/5062142.html