zoukankan      html  css  js  c++  java
  • iOS 控制屏幕横竖屏旋转

    当需求有a页面支持横屏和竖屏外,其他都是竖屏
    我现在的做法是:
    1)AppDelegate.m
    - (BOOL)shouldAutorotate {
       return NO;
    }

    - (NSUInteger)supportedInterfaceOrientations {
        
        return NO;
    }

    - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
        return  UIInterfaceOrientationPortrait;

    }

    2)A页面
    - (BOOL)shouldAutorotate {
        return YES;
    }

    - (NSUInteger)supportedInterfaceOrientations {
        
        return UIInterfaceOrientationMaskAll;
    }

    - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
        return  UIInterfaceOrientationPortrait;
    }

    // 注iOS9 

    #if __IPHONE_OS_VERSION_MAX_ALLOWED < __IPHONE_9_0

    - (NSUInteger)supportedInterfaceOrientations

    #else

    - (UIInterfaceOrientationMask)supportedInterfaceOrientations

    #endif

    {

        return UIInterfaceOrientationMaskPortrait;

    }

  • 相关阅读:
    Linux_vi编辑器
    Linux_几个符号命令
    Linux_权限
    Linux_用户/用户组
    Linux_文件及文件夹[创建][复制][移动][删除][重命名]
    Linux_文件查看
    Linux_初识
    码农网站
    学习网站
    软件设计师考试范围
  • 原文地址:https://www.cnblogs.com/zero-zql/p/4972807.html
Copyright © 2011-2022 走看看