http://blog.csdn.net/linhanmin/article/details/8048375
只支持portait,不能旋转:
-(BOOL)shouldAutorotate
{
return NO;
}
支持旋转:
-(BOOL)shouldAutorotate
{
return YES;
}
-(NSUInteger)supportedInterfaceOrientations{
return UIInterfaceOrientationMaskLandscape; //UIInterfaceOrientationMaskLandscape、UIInterfaceOrientationMaskAll、UIInterfaceOrientationMaskAllButUpsideDown
}
考虑到兼容低版本,最好加上:
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
return YES;
}
简单说明:
UIInterfaceOrientationMaskLandscape 支持左右横屏
UIInterfaceOrientationMaskAll 支持四个方向旋转
UIInterfaceOrientationMaskAllButUpsideDown 支持除了UpsideDown以外的旋转
本文详细解析了iOS应用中支持旋转与不旋转的功能实现方式,包括shouldAutorotate方法的使用、supportedInterfaceOrientations方法设置及shouldAutorotateToInterfaceOrientation方法的必要性,同时考虑了兼容低版本设备的优化措施。
248

被折叠的 条评论
为什么被折叠?



