ios旋转问题
2015-06-05 12:05
507 查看
函数介绍:
1、
// Returns interface orientation masks.
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
NS_***AILABLE_IOS(6_0);
意思就是说,如果该viewcontroller支持多个方向,但是刚进这个界面,你想让viewcontroller在那个方向?那么就调用这个这个函数。
比如
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskAllButUpsideDown;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return
UIInterfaceOrientationPortrait;
}
就是说:该viewcontroller支持,除了倒置以外的三个方向,但是刚进这个界面的时候无论设备朝那个方向,都是以竖直(UIInterfaceOrientationPortrait)这个方向显示,然后你可以转到其他支持的方向。
注意:这个函数必须返回一个支持的朝向,否则会crash。
1、
// Returns interface orientation masks.
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
NS_***AILABLE_IOS(6_0);
Returns the interface orientation to use when presenting the view controller. | |
The system calls this method when presenting the view controller full screen. You implement this method when your view controller supports two or more orientations but the content appears best in one of those orientations. If your view controller implements this method, then when presented, its view is shown in the preferred orientation (although it can later be rotated to another supported rotation). If you do not implement this method, the system presents the view controller using the current orientation of the status bar. |
比如
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskAllButUpsideDown;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return
UIInterfaceOrientationPortrait;
}
就是说:该viewcontroller支持,除了倒置以外的三个方向,但是刚进这个界面的时候无论设备朝那个方向,都是以竖直(UIInterfaceOrientationPortrait)这个方向显示,然后你可以转到其他支持的方向。
注意:这个函数必须返回一个支持的朝向,否则会crash。
相关文章推荐
- iOS 蓝色文件夹和黄色文件夹的区别
- IOS 保存图片至相册
- iOS第三方支付-银联支付
- ios 计算 文本高度!
- iOS开发-widget基础
- iOS利用Runtime自定义控制器POP手势动画
- iOS开发- 文件共享(利用iTunes导入文件, 并且显示已有文件)
- iOS动画效果整理
- iOS中AutoLayer自动布局流程及相关方法
- iOS image生成图片
- ios远程推送------------->非常详细
- Nagios简介
- [IOS 开发] 利用Runtime自定义控制器POP手势动画
- 解决ios safari中按钮圆角问题
- 【我们都爱Paul Hegarty】斯坦福IOS8公开课个人笔记30 ScrollView Demo实战
- [转]IOS如何访问通讯录
- iOS开发 tabBarController选中状态
- [iOS]CocoaPods安装
- iOS 绘图详解
- iOS 6导入PCH,开发必备