[转帖]iOS 6.0旋转兼容的那点事_VMware, Unix及操作系统讨论区_Weblogic技术|Tuxedo技术|中间件技术|Oracle论坛|JAVA论坛|Linux/Unix技术|hadoop论坛_联动北方技术论坛  
网站首页 | 关于我们 | 服务中心 | 经验交流 | 公司荣誉 | 成功案例 | 合作伙伴 | 联系我们 |
联动北方-国内领先的云技术服务提供商
»  游客             当前位置:  论坛首页 »  自由讨论区 »  VMware, Unix及操作系统讨论区 »
总帖数
1
每页帖数
101/1页1
返回列表
0
发起投票  发起投票 发新帖子
查看: 3674 | 回复: 0   主题: [转帖]iOS 6.0旋转兼容的那点事        下一篇 
zhang.chen
注册用户
等级:少校
经验:1145
发帖:69
精华:1
注册:2013-10-31
状态:离线
发送短消息息给zhang.chen 加好友    发送短消息息给zhang.chen 发消息
发表于: IP:您无权察看 2013-11-6 10:00:31 | [全部帖] [楼主帖] 楼主

这两天问答系统里,问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


原文地址:

 http://www.cocoachina.com/bbs/read.php?tid=121996




赞(0)    操作        顶端 
总帖数
1
每页帖数
101/1页1
返回列表
发新帖子
请输入验证码: 点击刷新验证码
您需要登录后才可以回帖 登录 | 注册
技术讨论