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 }
  • 相关阅读:
    DockerFile 解析
    Docker 容器数据卷
    Docker 镜像
    Docker 常用命令
    Docker 安装
    vue全站式笔记
    接口环境配置
    前端跨域的三种方式
    vue+axios 模拟后台返回数据的三种方式:本地创建json、easymock平台、mockjs
    cookie、sessionStorage与localStorage是什么?
  • 原文地址:https://www.cnblogs.com/jisa/p/8443972.html
Copyright © 2011-2022 走看看