zoukankan      html  css  js  c++  java
  • 获取设备的方向

    1.手机朝向的枚举

    typedef NS_ENUM(NSInteger, UIDeviceOrientation) {

        UIDeviceOrientationUnknown,

        UIDeviceOrientationPortrait,            // 设备面向垂直,home 按钮在底部

        UIDeviceOrientationPortraitUpsideDown,  // Device oriented vertically, home button on the top

        UIDeviceOrientationLandscapeLeft,       // 设备面向垂直,home 按钮在顶部

        UIDeviceOrientationLandscapeRight,      // 设备水平,面向 home 按钮在左边

        UIDeviceOrientationFaceUp,              // 设备平,面向脸了

        UIDeviceOrientationFaceDown             // 设备平,面向的脸

    } __TVOS_PROHIBITED;

    2.可以使用switch来记录设备的方向

    获取设备方向的枚举值

    [[UIDevice currentDevice] orientation]

    switch ([[UIDevice currentDevice] orientation])

        {

            case UIDeviceOrientationPortraitUpsideDown:

                break;

            case UIDeviceOrientationLandscapeLeft:

                break;

            case UIDeviceOrientationLandscapeRight:

                break;

            case UIDeviceOrientationFaceUp:

            default:

                break;

        }

  • 相关阅读:
    VS2010 正则批量替换头文件路径
    VC++ 内存泄露与检测的一种方法
    命令行编译C++程序
    Link1123:转换到COFF期间失败:文件无效或损坏
    C语言基础知识
    PCL深度图像(2)
    PCL关键点(1)
    PCL采样一致性算法
    PCL滤波介绍(3)
    PCL滤波介绍(2)
  • 原文地址:https://www.cnblogs.com/chaoyueME/p/6247708.html
Copyright © 2011-2022 走看看