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位十六进制序列(越狱的设备通过某些工具可 ...
随机推荐
- 怎样打开查看mysql binlog
1 在my.ini(window)配置文件里面 [mysqld]log-bin=mysql-bin(名字可以随便起) 我们每次进行操作的时候,File_size都会增长 2.show binlog e ...
- 【spring】【spring mvc】【spring boot】获取spring cloud项目中所有spring mvc的请求资源
实现的方法: 1.在父级项目中 或者 每个微服务都引用的项目中添加实体类Resource 2.在父级项目中 或者 每个为服务都引用的项目中写一个工具类,作用是用来获取请求资源 3.在每一个微服务的启动 ...
- 万里长征第二步——django个人博客(第四步 ——创建数据库)
在models.py内设置数据库模型 # -*- coding=utf-8 -*- from __future__ import unicode_literals from django.db imp ...
- linq直接执行sql语句
1.ExecuteQuery方法 看命名,我们很容易联想到ado.net里熟悉的Command的ExecuteNonQuery方法,但是VS的智能提示告诉我们这个方法返回的是一个泛型集合,应该&quo ...
- HDU1505(HDU1506的加强版)
昨天打 CF又跪了.近期睡不好睡不好睡不好-感觉整个人都累傻了,根本无办法写下去,只写了一题签到题就跪了orz..从未试过这么悲剧. 今天早上凭着我的意念("怨念").七点又起来了 ...
- [转载]抓包工具Charles乱码解决办法
FROM: http://blog.csdn.net/huanghanqian/article/details/52973651 安装 SSL 证书 Mac 端 首先去 http://www.char ...
- Linux下libsvm的安装及简单练习
引文:常常在看paper的时候.就看到svm算法,可是要自己来写真的是难于上青天呀! 所幸有一个libsvm的集成软件包给我们使用,这真的是太好了.以下简介下怎么来使用它吧! LIBSVM是一个集成软 ...
- js 实现存储Map 结构的数据
<script type="text/javascript"> function Map() { var struct = function(key, value) { ...
- vue - for遍历数组
注释上,也很清楚了哈. 1. item是循环名字,items是循环的数组 <!DOCTYPE html> <html lang="en"> <head ...
- 【转】Spring的中IoC及AOP
1. Spring介绍 Spring是轻量级的J2EE应用程序框架.Spring的核心是个轻量级容器(container),实现了IoC(Inversion of Control)模式的容器,Spri ...