![IOS7学习之路八(iOS 禁止屏幕旋转的方法) IOS7学习之路八(iOS 禁止屏幕旋转的方法)](https://image.shishitao.com:8440/aHR0cHM6Ly9ia3FzaW1nLmlrYWZhbi5jb20vdXBsb2FkL2NoYXRncHQtcy5wbmc%2FIQ%3D%3D.png?!?w=700&webp=1)
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{ return (toInterfaceOrientation == UIInterfaceOrientationPortrait); } - (BOOL)shouldAutorotate { return NO; } - (NSUInteger)supportedInterfaceOrientations { return UIInterfaceOrientationMaskPortrait;//只支持这一个方向(正常的方向) }
如果在UIViewController上,则在UIViewController对应的.m文件中加入三个函数即可。
如果在UITabBarController上,则在UITabBarController对应的.m文件中加入三个函数即可。
如果在UINavigationController上,则在UINavigationController对应的.m文件中加入三个函数即可。