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里面实现转屏的函数就可以了。

  • 相关阅读:
    Linq系列:基础与本质(Part III)
    CLR系列:浅析委托
    8万亿 全球第二还是最二?
    CLR系列:窥视HashTable
    c#3.0系列:Anonymous Type In CLR(3.5)
    VC6 编译选项问题
    C++资源库不完全版本
    如何用C实现C++的特性
    几种用于WSN的仿真工具
    嵌入式编程的好资源
  • 原文地址:https://www.cnblogs.com/superhappy/p/3013851.html
Copyright © 2011-2022 走看看