获得设备方向 UIInterfaceOrientation
来源:互联网 发布:算法时代txt 编辑:程序博客网 时间:2024/06/05 00:26
//获得设备方向
UIInterfaceOrientation orientation = [[UIApplicationsharedApplication]statusBarOrientation];
//程序启动时获取当前驱动的方向的方法
[[UIDevicecurrentDevice]beginGeneratingDeviceOrientationNotifications];
UIDeviceOrientation currentOrientation = [ [UIDevicecurrentDevice]orientation];
//currentOrientation 可以获得UIDevice 正面向上 向下方向
[[UIDevicecurrentDevice]endGeneratingDeviceOrientationNotifications];
另外方法:
1。获得启动时设备是横屏还是竖屏
在applicationDidFinishLaunching或老版本的OS版本中的applicationDidFinishLaunching获得CGRect的域size,比较width和height哪个比较大就可以了。
2。获得当前的设备是横屏还是竖屏
从UIDevice的orientation属性,就可以得到方向。
不过在获得方向之前要调用UIDevice的beginGeneratingDeviceOrientationNotifications方法更新设备信息。
在applicationDidFinishLaunching或老版本的OS版本中的applicationDidFinishLaunching获得CGRect的域size,比较width和height哪个比较大就可以了。
2。获得当前的设备是横屏还是竖屏
从UIDevice的orientation属性,就可以得到方向。
不过在获得方向之前要调用UIDevice的beginGeneratingDeviceOrientationNotifications方法更新设备信息。
- 获得设备方向 UIInterfaceOrientation
- 获得设备方向 UIInterfaceOrientation
- UIDeviceOrientation 和 UIInterfaceOrientation 设备旋转的方向
- ios 获得设备的方向
- 设备旋转UIDeviceOrientation 和 UIInterfaceOrientation
- UIInterfaceOrientation
- UIDeviceOrientation 和 UIInterfaceOrientation 设备旋转的用法
- UIDeviceOrientation 和 UIInterfaceOrientation 设备旋转的用法
- UIDeviceOrientation 和 UIInterfaceOrientation 设备旋转的用法 (实例)
- UIDeviceOrientation 和 UIInterfaceOrientation 设备旋转的用法 (实例)
- UIDeviceOrientation 和 UIInterfaceOrientation 设备旋转的用法 (实例)
- UIDeviceOrientation 和 UIInterfaceOrientation 设备旋转的用法 (实例)
- UIDeviceOrientation 和 UIInterfaceOrientation 设备旋转的用法 (实例)
- UIDeviceOrientation 和 UIInterfaceOrientation 设备旋转的用法 (实例)
- UIDeviceOrientation 和 UIInterfaceOrientation 设备旋转的用法 (实例)
- UIDeviceOrientation 和 UIInterfaceOrientation 设备旋转的用法 (实例)
- UIDeviceOrientation 和 UIInterfaceOrientation 设备旋转的用法 (实例)
- 获得照片方向信息
- 如何清空NSMutableData内存
- Hibernate 本地SQL查询
- 看老外程序员如何向妻子解释设计模式
- call stack
- [转]Localize your apps and content more easily – new formats in Translator Toolkit
- 获得设备方向 UIInterfaceOrientation
- PKG_CONFIG_PATH变量 与 ld.so.conf 文件
- 解开 Windows 下的临界区中的代码死锁
- 散列表
- 25个Apache性能优化技巧推荐(收藏用)
- 【Oracle问题集1】 ORA-00845: MEMORY_TARGET not supported on this system
- DataSnap理解
- SplitContainer(拆分条控件)
- ios 获取屏幕的属性和宽度