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位十六进制序列(越狱的设备通过某些工具可 ...
随机推荐
- Eclipse启动时禁用不必要的验证。
window>preferences>general>editors>text editors>Annotations,右边的Annotation type里,点选err ...
- java/eclipse/myeclipse建立.properties文件的方法
相比较来说,Java程序的编写相对简单很多,多数文件都可以通过编写文本文件生成! 对于不用IDE的java程序来讲,只需要右键新建>文本文件,建立好以后写好代码,另存为xx.prop ...
- SecureCRT配置文件保存和导入
每次重装系统,都要重新配置SecureCRT,为了减少重复工作.直接在SecureCRT软件中找到:选项---全局选项---常规---配置文件夹下面路径:C:\Users\Administrator\ ...
- python利用opencv去除水印方法
OpenCV(Open Source Computer Vision Library)是一个跨平台计算机视觉库,实现了图像处理和计算机视觉方面的很多通用算法 在python中可以利用opencv来去除 ...
- SVN-项目 XXX 受源代码管理。向源代码管理注册此项目时出错。建议不要对此项目进行任何修改
错误描述: 项目 XXX 受源代码管理.向源代码管理注册此项目时出错.建议不要对此项目进行任何修改 解决办法: 使用记事本打开,项目csproj文件删除图中几行,重新打开解决方案就可以了 原因分析: ...
- jstl表达式引用文件
<script type="text/javascript" src="<c:url value="/resources/js/common/jqu ...
- Android数据库之基本概念(上)
1.Android数据库简单介绍 Android通过结合使用SQLite数据库和Content Provider,提供了结构化数据的持久功能. SQLite数据库能够通过一种结构化的.易于管理的方法来 ...
- 解复用-mpeg2
http://blog.csdn.net/yipie/article/details/7612226 数字高清晰度电视(High Definition Television)简称HDTV,是继黑白电视 ...
- stderr和stdout详细解说(转)
今天又查了一下fprintf,其中对第一个参数stderr特别感兴趣. int fprintf(FILE *stream,char *format,[argument]): 在此之前先区分一下:pri ...
- 08-spring学习-annotation配置
利用annotation配置注入关系 为了更好的解释此类存在的意义,下面通过一段习惯性的开发进行问题的描述,例如: 现在有一个IAdminService服务层,这个服务层要调用的是IAdminDAO和 ...