zoukankan      html  css  js  c++  java
  • iOS获取当前设备方向

    三种方式:

    • self.interfaceOrientation
    • [[UIApplication sharedApplication] statusBarOrientation]
    • [[UIDevice currentDevice] orientation]

    但是实际使用时有区别的:

    self.interfaceOrientation returns UIInterfaceOrientation, current orientation of the interface. It is a property in UIViewController, you can access to this one only in UIViewController classes.

    [[UIApplication sharedApplication] statusBarOrientation] returns UIInterfaceOrientation, current orientation of the application's status bar. You can access to that property in any point of your application. My experience shows that it's more effective way to retrieve real interface orientation.

    [[UIDevice currentDevice] orientation] returns UIDeviceOrientation, device orientation. You can access to that property in any point of your application. But note that UIDeviceOrientation is not always UIInterfaceOrientation. For example, when your device is on a plain table you can receive unexpected value.

    原文:http://stackoverflow.com/questions/7968451/different-ways-of-getting-current-interface-orientation

  • 相关阅读:
    数据类型基本用法二
    数据类型基本用法一
    循环
    python数据类型简介
    语言发展与python
    LeetCode429-N叉树的层次遍历(队列)
    实验室做过的东西
    使用ajax处理表单提交信息
    LeetCode415-字符串相机(水题)
    《UML大战需求分析》-读后感一
  • 原文地址:https://www.cnblogs.com/Yukang1989/p/3160980.html
Copyright © 2011-2022 走看看