ios旋转问题

函数介绍:

1、

// Returns interface orientation masks.

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation NS_AVAILABLE_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。


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值