iOS 6.0旋转兼容的那点事
来源:互联网 发布:vue.js 2.0浏览器支持 编辑:程序博客网 时间:2024/06/09 20:34
这两天问答系统里,问ios横竖屏切换、还有状态栏旋转的问题有点多,来些小心得,希望遇到的人少走弯路;
先贴官方说明:
iOS 6.0 Release Notes:
Autorotation is changing in iOS 6. In iOS 6, the shouldAutorotateToInterfaceOrientation: method
of UIViewController is deprecated.In its place, you should use the supportedInterfaceOrientationsForWindow:
and shouldAutorotate methods.
在iOS 6.0之前我们都是使用shouldAutorotateToInterfaceOrientation方法来控制视图、状态栏的旋转,但是iOS 6.0及以后
就要使用supportedInterfaceOrientations方法来控制旋转了;
所以向iOS 6.0兼容的需要手动添加supportedInterfaceOrientations 方法,来控制视图和 状态栏的旋转,还有两点需要说明:
1、在iOS 6.0之前,控制旋转的代码,无需和plist的中的Supported interface orientations一一对应,举个例子:
plist的Supported interface orientations选项中支持,Portrait(bottom home button)、Landscape(right home button),无Landscape(left home button)
方法shouldAutorotateToInterfaceOrientation中强制支持UIInterfaceOrientationLandscapeLeft编译执行没有任何问题,
但是在iOS 6.0中,如果在supportedInterfaceOrientations中添加UIInterfaceOrientationMaskLandscapeLeft编译正常,
运行过程中,左旋转程序就会异常退出;所以程序支持旋转的,代码与plist一定要保持一致;
2、在Xcode 4.5之前旋转支持的是
UIInterfaceOrientationLandscapeLeft
UIInterfaceOrientationLandscapeRight
UIInterfaceOrientationPortrait
UIInterfaceOrientationPortraitUpsideDown
而Xcode 4.5 GM Seed及Xcode 4.5.1旋转支持的是(多了个All,还有Mask的修饰,Xcode 4.5之前是不识别的)
UIInterfaceOrientationMaskAll
UIInterfaceOrientationMaskLandscapeLeft
UIInterfaceOrientationMaskLandscapeRight
UIInterfaceOrientationMaskPortrait
UIInterfaceOrientationMaskPortraitUpsideDown
先贴官方说明:
iOS 6.0 Release Notes:
Autorotation is changing in iOS 6. In iOS 6, the shouldAutorotateToInterfaceOrientation: method
of UIViewController is deprecated.In its place, you should use the supportedInterfaceOrientationsForWindow:
and shouldAutorotate methods.
在iOS 6.0之前我们都是使用shouldAutorotateToInterfaceOrientation方法来控制视图、状态栏的旋转,但是iOS 6.0及以后
就要使用supportedInterfaceOrientations方法来控制旋转了;
所以向iOS 6.0兼容的需要手动添加supportedInterfaceOrientations 方法,来控制视图和 状态栏的旋转,还有两点需要说明:
1、在iOS 6.0之前,控制旋转的代码,无需和plist的中的Supported interface orientations一一对应,举个例子:
plist的Supported interface orientations选项中支持,Portrait(bottom home button)、Landscape(right home button),无Landscape(left home button)
方法shouldAutorotateToInterfaceOrientation中强制支持UIInterfaceOrientationLandscapeLeft编译执行没有任何问题,
但是在iOS 6.0中,如果在supportedInterfaceOrientations中添加UIInterfaceOrientationMaskLandscapeLeft编译正常,
运行过程中,左旋转程序就会异常退出;所以程序支持旋转的,代码与plist一定要保持一致;
2、在Xcode 4.5之前旋转支持的是
UIInterfaceOrientationLandscapeLeft
UIInterfaceOrientationLandscapeRight
UIInterfaceOrientationPortrait
UIInterfaceOrientationPortraitUpsideDown
而Xcode 4.5 GM Seed及Xcode 4.5.1旋转支持的是(多了个All,还有Mask的修饰,Xcode 4.5之前是不识别的)
UIInterfaceOrientationMaskAll
UIInterfaceOrientationMaskLandscapeLeft
UIInterfaceOrientationMaskLandscapeRight
UIInterfaceOrientationMaskPortrait
UIInterfaceOrientationMaskPortraitUpsideDown
0 0
- iOS 6.0旋转兼容的那点事
- iOS6.0旋转兼容的那点事
- iOS 6.0旋转兼容
- IOS 关于分辨率的那点事
- IOS编译的那点事
- iOS时间那点事
- iOS时间那点事
- iOS时间那点事
- iOS面试那点事
- 机顶盒兼容那点事情
- 前端开发的那点事-------------ie绝对是个神坑,360浏览器的兼容模式依然是个神坑
- 关于VS编译兼容XP的那点事(转)
- iOS开发中ARC的那点事
- iOS Block与self的那点事
- 手动控制屏幕旋转时2.3与4.0之间的那点事
- Xcode 7+ 和 iOS9 兼容那点事
- iOS-计算绕某点旋转得到旋转后的点公式
- iOS时间那点事--NSDate
- c++中的static
- Java面向对象(五)
- 字符编码 编码转换 乱码
- 抛一个kalman滤波跟踪的封装类 c++版opencv实现
- 硬件电路点点滴滴“女屌逆袭”1---旁路电容/去耦电容
- iOS 6.0旋转兼容的那点事
- IIS6.0之301跳转
- SocketAddress类
- Core Animation之多种动画效果
- 说不清心里对于这个孩子是什么样的感情
- 【分享】用于可删除集挖掘(Erasable Itemset Mining)的数据集
- C#连接数据库sqlserver2005,执行存储过程的实例
- Android之判断某个服务是否正在运行的方法
- IOS 开发中 UIColor 的使用