iOS 6 手持方向处理
来源:互联网 发布:淘宝中小卖家生存困难 编辑:程序博客网 时间:2024/04/27 23:49
iOS6手持方向处理
从iOS 5的应用程序更新到iOS6很多特性没法正常工作。主要的问题是,有一些API在新的SDK中已被弃用。其中手持方向的判断就是很明显的一个
存在的问题
假如你应用程序只有一个屏要是横向,其它的屏都要是纵向。
iOS5的解决方案
在应用程序的Info.plist文件,Supported interface orientations应该只包含一个项目,Portrait 。
接下来,在需要的方向锁定为横向视图控制器类,你需要重写- (BOOL)shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation)interfaceOrientation
方法,并返回YES
或NO
相对一个布尔值,检查对interfaceOrientation
参数。
下面是函数看起来像什么。
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{ return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight);}
iOS6的解决方案
在iOS 6
方法已过时,似乎没有被调用了。代替它的一组方法;-(BOOL)shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation)interfaceOrientation
-(BOOL)shouldAutorotate
和
-(NSUInteger)supportedInterfaceOrientations的
。
在UIViewController,你要在横向的,你需要同时重写- (BOOL)shouldAutorotate
- (NSUInteger)supportedInterfaceOrientations的
:
// iOS6中过时, 为了兼容iOS5.// ---- (BOOL)shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation)interfaceOrientation{ return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight);}// iOS6 support// ---- (BOOL)shouldAutorotate{ return NO;}- (NSUInteger)supportedInterfaceOrientations{ return UIInterfaceOrientationMaskLandscape;}// ---
- iOS 6 手持方向处理
- iOS处理照片的方向
- iOS UIImagePicker 图片方向不正确 处理
- 如何处理iOS中照片的方向
- 如何处理iOS中照片的方向
- 如何处理iOS中照片的方向
- 如何处理iOS中照片的方向
- iOS单个方向的圆角处理
- 如何处理iOS中照片的方向
- 如何处理iOS中照片的方向
- 如何处理iOS中照片的方向
- 如何处理iOS中照片的方向
- 如何处理iOS中照片的方向
- 如何处理iOS中照片的方向
- 如何处理iOS中照片的方向
- iOS上传图片方向不对处理
- ios方向
- ios 处理图片固定其方向的一个方法
- 后缀数组模版
- 您的身上是否具备了成功的“基因”?
- 连连看游戏~~~可以直接用鼠标点击两个格子来消去。。。
- 一个Spring + Json异常的问题
- 11gr2 重新创建 diskgroup
- iOS 6 手持方向处理
- 不用xmlhttprequest,实现ajax请求
- VB6 控制IE弹出模式窗口
- Cookie
- [解密骗术]沙漠玫瑰
- stub 例子
- 续spring mvc+velocity之spring mvc + freemarker整合开发
- a summary of python crawler
- Python学习的小问题1(SyntaxError: Non-ASCII character)