zoukankan      html  css  js  c++  java
  • IOS 5.0 6.0 横竖屏 处理总结

    简单的来说用xcode4.5直接创建的项目是直接支持 ios6.0横竖屏的,但是用IOS5.0的模拟器运行发现不支持横竖屏,这时候就要把以前的 横竖屏函数搬出来了。

    针对横屏示例:

    // ios5下的横屏

    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {

    return UIInterfaceOrientationIsLandscape(interfaceOrientation);

    }

    // ios6下的横屏

    -(BOOL)shouldAutorotate {

    return YES;

    }

    -(NSUInteger)supportedInterfaceOrientations {

    return UIInterfaceOrientationMaskLandscape;

    }

    对于有 navigation的 IOS6的需求,A(竖屏) 推出的B  B要只能横屏,这时候就需要实现一个navigation的子类的,然后在这个子类实现如下的代码

    -(NSUInteger)supportedInterfaceOrientations{  

        if([[self topViewController] isKindOfClass:[SubSubView class]])  

            return UIInterfaceOrientationMaskAllButUpsideDown;  

           return UIInterfaceOrientationMaskPortrait;  

    }

    -(NSUInteger)supportedInterfaceOrientations{

        if([[self topViewController] isKindOfClass:[SubSubView class]])

            return UIInterfaceOrientationMaskAllButUpsideDown;

        else

            return UIInterfaceOrientationMaskPortrait;

    }

    然后 再在B里面实现转屏的函数就可以了。

  • 相关阅读:
    iPhone 调用Web Service 例子(转)
    iPhone开发:在UIAlertView中显示进度条(转)
    Oracel 分页
    NYOJ 477
    NYOJ 108(数组中存的是前n个数的和)
    NYOJ 199
    NYOJ 311(完全背包)
    高效斐数(前92位)
    NYOJ 57(6174问题)
    NYOJ 546(分珠宝)
  • 原文地址:https://www.cnblogs.com/superhappy/p/3013851.html
Copyright © 2011-2022 走看看