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
iOS获取当前设备方向的更多相关文章
- IOS 获取最新设备型号方法
1.IOS 获取最新设备型号方法列表最新对照表:http://theiphonewiki.com/wiki/Models方法: #import "sys/utsname.h” struct ...
- iOS获取用户设备崩溃日志并分析
项目最近发布,部分用户在内侧使用,正好遇到一些问题,由于用户在其他城市,所以对于用户设备产生的崩溃日志,不好直接拿设备连接电脑. 对于这种情况,我们可以这样: 1.引导用户开启iOS设备设置-> ...
- iOS 获取摄像头当前方向
在做二维码扫描和直播获取视频流的过程中,可能会用到 AVCaptureDevice AVCaptureVideoPreviewLayer AVCaptureSession 这几个参数,其中 1.定义显 ...
- ios 获取当前设备信息、内存
//在[UIDevice currentDevice]中的属性 @property(nonatomic,readonly,strong) NSString *name; // e.g. "M ...
- IOS获取手机设备型号
最新型号的设备列表https://www.theiphonewiki.com/wiki/Models #import "iosutils/IOSUtils.h" #import & ...
- ios 获取手机设备信息
[UIDevice currentDevice]:表示设备 NSString *devices=[[NSString alloc] initWithFormat: @"unique id: ...
- IOS获取手机设备所有应用
//返回一个数组 1 NSMutableArray *applist = [[NSMutableArray alloc]init]; NSString *pathOfApplications = @& ...
- IOS 特定于设备的开发:处理基本方向
UIDevice类使用内置的orientation属性获取设备的物理方向.IOS设备支持这个属性的7个可能的值. >UIDeviceOrientationUnknown:方向目前未知. > ...
- iOS获取设备唯一标识的8种方法
8种iOS获取设备唯一标识的方法,希望对大家有用. UDID UDID(Unique Device Identifier),iOS 设备的唯一识别码,是一个40位十六进制序列(越狱的设备通过某些工具可 ...
随机推荐
- html模板与json数据交互
阅读这篇文章后,对html和json有很大的启发: http://www.zhangxinxu.com/wordpress/2012/09/javascript-html-json-template/ ...
- python的globals()使用
使用命令pyrasite-shell pid,可以与进程进行shell交互,获取,在shell里执行globals(),可以获取整个进程的全部全局变量,比如django应用.flask应用的变量,而不 ...
- 【转载】WebStorm安装 & Nodejs-Express Demo
试试下面这个方法: http://www.sdifenzhou.com/?p=6941 从这里下载 http://pan.baidu.com/share/link?shareid=2512210975 ...
- 阅读ARm芯片手册 阅读方法
一 overview 1 table of contents -*** 2 product overview -*** 芯片概述 3 feature *** 每一个功能的特点 4 block ...
- screen space reflection/soft alpha test/
http://www.crytek.com/cryengine/presentations/secrets-of-cryengine-3-graphics-technology 很多宝贝里面 不止题目 ...
- TensorFlow------读取CSV文件实例
TensorFlow之读取CSV文件实例: import tensorflow as tf import os def csvread(filelist): ''' 读取CSV文件 :param fi ...
- PowerShell中的一个switch的例子
在这个例子中, 应该注意 Switch语句里对数字范围条件的使用 break的使用 字符串的拼接 数组的声明 ) foreach ($element in $array) { switch($el ...
- 将本地jar包添加到maven中
将需要引入的jar包拷贝到maven项目的WEB-INF/lib中 在pom.xml中配置如下: <dependency> <groupId>com.xxxxx.union&l ...
- phpMailer中文说明[转]
A开头: $AltBody--属性出自:PHPMailer::$AltBody文件:class.phpmailer.php说明:该属性的设置是在邮件正文不支持HTML的备用显示 AddAddress- ...
- MP3中设置播放顺序的软件《闪存式MP3伴侣》
给姥爷买了一个插卡音箱,里面拷贝了几百段评书,每一段评书都是一个mp3文件,虽然插卡音箱会自动一个文件一个文件自动播放,可是比较郁闷的是评书的播放顺序完全是乱的,毫无规律可寻,本来我的mp3文件的文件 ...