zoukankan      html  css  js  c++  java
  • 判断横竖屏的方法

    1. 

    CGRect aRect = [[UIScreenmainScreen] applicationFrame];

        if (aRect.size.height>768) {

            

            NSLog(@"height ::%f",aRect.size.height);

            NSLog(@"竖屏幕.....");

        

        }else {

            NSLog(@"height ::%f",aRect.size.height);

            NSLog(@"横屏幕.....");

        }

     

    2. 有时候 没有用  这个问题我没有深究......

     

    UIDeviceOrientation DO = [[UIDevicecurrentDevice]orientation];

        NSLog(@"DO::%i",DO);

        if (UIInterfaceOrientationIsPortrait(DO)) {

               NSLog(@"竖屏幕.....");

        }

        else {

             NSLog(@"横屏幕.....");

        }

     

    3.

     UIDeviceOrientation DO = self.interfaceOrientation;

        if (UIInterfaceOrientationIsPortrait(DO)) {

     

            // 竖屏

      

        }else {

            NSLog(@"横屏幕.....");

            // 横屏

        

     

        }

  • 相关阅读:
    python爬虫
    RMQ算法
    组合数
    水池数目
    jQuery 拼接事件
    ORACLE
    day 75
    day74 vue框架
    day73 vue框架
    day 72 vue框架
  • 原文地址:https://www.cnblogs.com/zander/p/2673429.html
Copyright © 2011-2022 走看看