zoukankan      html  css  js  c++  java
  • 设置屏幕旋转 (以下方法按着顺序设置)

    UIInterfaceOrientationUnknown            = UIDeviceOrientationUnknown, 界面取向未知

        UIInterfaceOrientationPortrait           = UIDeviceOrientationPortrait, 正常的肖像模式 就是向上

        UIInterfaceOrientationPortraitUpsideDown = UIDeviceOrientationPortraitUpsideDown, 向下

        UIInterfaceOrientationLandscapeLeft      = UIDeviceOrientationLandscapeRight,  向右

    UIInterfaceOrientationLandscapeRight     = UIDeviceOrientationLandscapeLeft   向左

    -(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation

    {

     返回YES支持旋转 NO不支持旋转

    通过获取UIDevice的userInterfaceIdiom属性,可以检测到当前程序是运行在iphone或者是ipad上

      if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {

          return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);

      } else {

          return YES;

      }

    }

    这个方法是发生在翻转开始之前。一般用来禁用某些控件或者停止某些正在进行的活动,比如停止视频播放

    -(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration

    -(void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration

    这个方法发生在翻转的过程中,一般用来定制翻转后各个控件的位置、大小等。可以用另外两个方法来代替:willAnimateFirstHalfOfRotationToInterfaceOrientation:duration:   和  willAnimateSecondHalfOfRotationFromInterfaceOrientation:duration:

      

    - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation

    这个方法发生在整个翻转完成之后。一般用来重新启用某些控件或者继续翻转之前被暂停的活动,比如继续视频播放。

  • 相关阅读:
    springboot项目使用AOP切面记录用户操作日志
    SpringBoot之——log4j日志配置案例
    IDEA--IDEA debug断点调试技巧
    LINUX FG、BG、JOBS命令用法
    消息队列学习记录
    JDK1.8下载与安装以及配置环境变量
    mysql 时间戳转换为年月日时分秒
    Java关于ExecutorService线程池的使用简介
    idea实现热部署
    MySQL 行行比较sql写法
  • 原文地址:https://www.cnblogs.com/zhaozhongpeng/p/4867947.html
Copyright © 2011-2022 走看看