您的位置:首页 > 移动开发 > IOS开发

ios旋转问题

2015-06-05 12:05 507 查看
函数介绍:

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.
意思就是说,如果该viewcontroller支持多个方向,但是刚进这个界面,你想让viewcontroller在那个方向?那么就调用这个这个函数。
比如

- (NSUInteger)supportedInterfaceOrientations
{

return UIInterfaceOrientationMaskAllButUpsideDown;

}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return
UIInterfaceOrientationPortrait;
}
就是说:该viewcontroller支持,除了倒置以外的三个方向,但是刚进这个界面的时候无论设备朝那个方向,都是以竖直(UIInterfaceOrientationPortrait)这个方向显示,然后你可以转到其他支持的方向。
注意:这个函数必须返回一个支持的朝向,否则会crash。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: