iPhone自动旋转控制代码-IOS开发
2012-03-12 00:00
477 查看
声明 欢迎转载,但是请尊重作者劳动成果,转载请保留此框内声明,谢谢。 文章出处:http://blog.csdn.net/iukey |
在你想要设置的视图控制器里找到 shouldAutorotateToInterfaceOrientation: 方法,重写它的实现代码:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{ return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft); }
系统通过调用此方法询问试图控制是否旋转到指定方向。系统共定义了4种方向,分别对应4种常见握持方式:
typedef enum { UIInterfaceOrientationPortrait = UIDeviceOrientationPortrait, UIInterfaceOrientationPortraitUpsideDown = UIDeviceOrientationPortraitUpsideDown, UIInterfaceOrientationLandscapeLeft = UIDeviceOrientationLandscapeRight, UIInterfaceOrientationLandscapeRight = UIDeviceOrientationLandscapeLeft } UIInterfaceOrientation;
如果想要对任何情况都支持旋转只要返回YES即可,如果只想部分支持就对支持的返回YES 不支持的返回NO。
最后附上Demo代码:AutoOreintationDemo
$(document).ready(function(){dp.SyntaxHighlighter.HighlightAll('code');});
原文链接:
http://blog.csdn.net/iukey/article/details/7331757
相关文章推荐
- iPhone自动旋转控制代码-IOS开发
- iPhone自动旋转控制代码-IOS开发
- iPhone自动旋转控制代码-IOS开发
- iOS开发笔记之代码控制屏幕旋转
- iOS 代码控制iPhone&iPad旋转
- ios-AutoLayout(自动布局代码控制)简单总结
- 【IOS 开发学习总结-OC-61】IOS 的自动旋转
- iphone开发 IOS中CoreData的通用代码
- ios-AutoLayout(自动布局代码控制)简单总结
- 【iOS开发问题】Xcode代码格式化与自动排版
- 总结iOS App开发中控制屏幕旋转的几种方式
- iOS-AutoLayout(自动布局代码控制)简单总结
- iOS开发中控制屏幕旋转,个别界面强制横屏
- 【iPhone开发】ios统计流量代码
- iOS开发代码自动布局NSLayoutConstraint
- iOS开发- 相机(摄像头)获取到的图片自动旋转90度解决办法
- iOS开发笔记--使用Auto Layout中的VFL(Visual format language)--代码实现自动布局
- iPhone开发:Objective C 代码规范-iOS总结版
- iOS AutoLayout自动布局中级开发教程(6)-淘宝客户端iPhone 6/6 Plus 设计·适配方案
- iOS 开发设置空间旋转中心点的代码