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

    iOS屏幕旋转

    在设置某个特定的界面可以横屏的时候,跟UINavigationController,UITabbarController相关的控制器,会默认走基类的转屏方法,自己写的不会生效。故要把转屏的控制权交给跟控制器。在子Controller中定义转屏的方向。

    /// 跟控制器是UINavigationController
    /// 是否允许转屏
    - (BOOL)shouldAutorotate {
        return YES;
    }
    
    /// 支持的方向
    - (UIInterfaceOrientationMask)supportedInterfaceOrientations {
        return [self.viewControllers.lastObject supportedInterfaceOrientations];
    }
    /// 模态时的方向
    - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
        return self.topViewController.preferredInterfaceOrientationForPresentation;
    }
     1 /// 跟控制器是UITabBarController时
     2 - (BOOL)shouldAutorotate
     3 {
     4     return YES;
     5 }
     6 
     7 - (UIInterfaceOrientationMask)supportedInterfaceOrientations {
     8     return ((UINavigationController *)self.selectedViewController).topViewController.supportedInterfaceOrientations;
     9 }
    10 
    11 - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
    12     return ((UINavigationController *)self.selectedViewController).topViewController.preferredInterfaceOrientationForPresentation;
    13 }
  • 相关阅读:
    centos 网络开启
    ubuntu server 服务器部署(二) mysql 安装配置手记
    ubuntu server 服务器部署(一) jdk 安装配置手记
    网络管理
    磁盘配额
    创建raid0
    创建raid5
    逻辑卷快照
    LVM(逻辑卷)
    1.计算机基础
  • 原文地址:https://www.cnblogs.com/jisa/p/8443972.html
Copyright © 2011-2022 走看看