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 }
  • 相关阅读:
    js浏览器对象
    js对象
    js基础
    css的常见操作
    css 盒子模型
    css定位与浮动
    汇编三(习题)
    pyEcharts安装及使用指南(最新)
    pyEcharts安装及使用指南
    Anaconda安装第三方库与pip和conda 添加国内源
  • 原文地址:https://www.cnblogs.com/jisa/p/8443972.html
Copyright © 2011-2022 走看看