zoukankan      html  css  js  c++  java
  • ios6和ios7禁止屏幕旋转

    ios6和ios7禁止屏幕旋转

    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation

    {

        return (toInterfaceOrientation == UIInterfaceOrientationPortrait);

    }

    - (BOOL)shouldAutorotate

    {

        return NO;

    }

    - (NSUInteger)supportedInterfaceOrientations

    {

        return UIInterfaceOrientationMaskPortrait;//只支持这一个方向(正常的方向)

    }这些方法不行 

    再。。。。。

    在appdelegate中添加如下代码

    - (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window{

        if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)

            return UIInterfaceOrientationMaskAll;

        else  /* iphone */

            return UIInterfaceOrientationMaskPortrait ;

    }

  • 相关阅读:
    Java通过stream将list转换成map
    Java 标记接口
    Java的LinkedList
    Java中的数组
    Java的异常
    初识lambda
    Combining a Collection of Predicates
    重载
    svm资料收集
    向量空间及其他相关数学结构
  • 原文地址:https://www.cnblogs.com/zhujin/p/3842607.html
Copyright © 2011-2022 走看看