环境:IOS7,iPhone5。大家都知道写法:
// 是否支持屏幕旋转 - (BOOL)shouldAutorotate { return YES; } // 支持的旋转方向 - (NSUInteger)supportedInterfaceOrientations { return UIInterfaceOrientationMaskAllButUpsideDown;//UIInterfaceOrientationMaskAllButUpsideDown; } // 一开始的屏幕旋转方向 - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation { return UIInterfaceOrientationPortrait; }
如果我的原VC是横屏,但是弹出来一个要竖屏的怎么办?看代码:
方法如下:
// 是否支持屏幕旋转 - (BOOL)shouldAutorotate { return NO; } /* // 支持的旋转方向 不能重写这个函数,否则崩溃 - (NSUInteger)supportedInterfaceOrientations { return UIInterfaceOrientationMaskAllButUpsideDown;//UIInterfaceOrientationMaskAllButUpsideDown; }*/ // 一开始的屏幕旋转方向 - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation { return UIInterfaceOrientationPortrait; }