- (NSUInteger)supportedInterfaceOrientations 屏幕旋转方向选择

方法名称

supportedInterfaceOrientations

作用:       

返回一个ViewController支持的方向,也就是说你返回这个方向是你屏幕启动后就保持的方向,如让他默认横屏或者竖屏

返回值类型:

          返回的方向在UIInterfaceOrientationMask 中定义 (PS:话说左横屏和右横屏右神马区别,竖屏跟倒立竖屏有神马区别,不明白)
  •         UIInterfaceOrientationMaskPortrait  竖屏
  •     UIInterfaceOrientationMaskLandscapeLeft  左横屏
  •     UIInterfaceOrientationMaskLandscapeRight 右横屏
  •     UIInterfaceOrientationMaskPortraitUpsideDown:倒立竖屏
  •     UIInterfaceOrientationMaskLandscape:仅支持横屏
  •     UIInterfaceOrientationMaskAll:支持全部
  •     UIInterfaceOrientationMaskAllButUpsideDown:除了倒立竖屏都支持
 

注意事项 

          1.仅在IOS6 以后才能用
          2.用户在每次改变屏幕转动方向的时候,会先调用shouldAutorotate,再调用它,这就说明,仅在shouldAutorotate方法返回值是YES的时候这个方法才会起作用!
       3.如果没有重写这个方法,ipad默认返回的值是UIInterfaceOrientationMaskAll ,iphone默认返回的值是UIInterfaceOrientationMaskAllButUpsideDown,也就是说默认情况下iOS是支持翻转屏幕的

使用方法

#pragma mark - 设置屏幕支持的翻转方向,在shouldAutorotate为YES时起作用
-(NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskPortrait;
}



          
效果展示
         无 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值