zoukankan      html  css  js  c++  java
  • 关于ios6.0和5.0的横竖屏支持方法

    iOS6.0中抛弃了- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation的方法对横竖屏切换的支持

    ios6.0中的对横竖切换的支持步骤为

    第一 info.plistSupported interface orientations中加入支持的方向
    第二 在 AppDelegate中加入 -(NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window{ return UIInterfaceOrientationMaskAll;} 
    第三 你想控制旋转的界面
    -(NSUInteger)supportedInterfaceOrientations{ 
        return UIInterfaceOrientationMaskPortrait // 可以修改为任何方向
    }
    -(BOOL)shouldAutorotate{
       return YES;
    }
    5.0的是
    -(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation{
     
        return (toInterfaceOrientation == UIInterfaceOrientationPortrait);  // 你在这返回的参数中可以修改为任何你想支持方向
    }
     
  • 相关阅读:
    接口内容小结
    接口的静态方法与私有方法
    接口的默认方法
    发红包O
    抽象
    《大道至简》读后感
    重写
    继承中的二义性问题
    数学应用
    继承
  • 原文地址:https://www.cnblogs.com/leevaboo/p/2853014.html
Copyright © 2011-2022 走看看