zoukankan      html  css  js  c++  java
  • iPhone屏幕旋转

    iPhone屏幕内容旋转

    在iOS6之前的版本中,通常使用 shouldAutorotateToInterfaceOrientation 来单独控制某个UIViewController的方向,需要哪个viewController支持旋转,只需要重写shouldAutorotateToInterfaceOrientation方法。

    但是iOS 6里屏幕旋转改变了很多,之前的 shouldAutorotateToInterfaceOrientation 被列为 DEPRECATED 方法,从IOS6开始使用新的方法来控制屏幕内容的旋转

    操作方法

    1:定义一个UINavigationController的子类,然后添加下面的代码

    - (BOOL)shouldAutorotate

    {

        return self.topViewController.shouldAutorotate;

    }

     

    - (NSUInteger)supportedInterfaceOrientations

    {

        returnself.topViewController.supportedInterfaceOrientations;

    }

     

    2:将window.RootController 制定为这个自定义的类

     

    3:重载下面两个方法来控制页面内容是否随着屏幕旋转

    -(BOOL)shouldAutorotate

    {

        return NO;

    }

     

    -(NSUInteger)supportedInterfaceOrientations

    {

        return UIInterfaceOrientationMaskPortrait;

    }

    Jason

    2014年02月14日

  • 相关阅读:
    Jmeter四种参数化方式
    微信公众号开发--服务器接入
    IIS调试程序
    vs连接GitHub
    vs2013 卸载
    Edge,IE浏览器 兼容模式设置
    XML非法字符的处理
    SQL Server Union联合查询
    SQL Server NULL的正确用法
    SQL Server Like 与 通配符
  • 原文地址:https://www.cnblogs.com/xingchen/p/3549590.html
Copyright © 2011-2022 走看看