• iOS获取当前设备方向


    http://www.cnblogs.com/Yukang1989/p/3160980.html

    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

  • 相关阅读:
    Composer autoload 自动加载
    权限问题
    加载适配器和布局之间的顺序关系--Unsolved
    listview和button
    线程练习中出现的错误
    线程02
    关于初始化成员变量
    可扩展列表
    Android开发中Handler的经典总结----转载
    线程01
  • 原文地址:https://www.cnblogs.com/xuejinhui/p/4293319.html
Copyright © 2020-2023  润新知