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位十六进制序列(越狱的设备通过某些工具可 ...
随机推荐
- CentOS上安装分布式文件系统FastDFS & 配置和问题解决
原文:https://my.oschina.net/wangmengjun/blog/1142982 什么是FastDFS? FastDFS是一个开源的分布式文件系统,她对文件进行管理,功能包括:文件 ...
- DXR
https://github.com/ConfettiFX/The-Forge/blob/master/CommonRaytracing_3/ThirdParty/DXR/doc/D3D12%20Ra ...
- VB6.0中数组的定义实測
作者:iamlasong 1.环境 Visual Basic 6.0精简版,由于仅仅做一些小工具,认为这个已经够了.我认为.编程语言.数据库等东西,不一定要用最新的,适合.够用就好,比方Win8都出来 ...
- urllib库在python2和python3环境下的使用区别
好东西啊!!! Python 2 name Python 3 name urllib.urlretrieve() urllib.request.urlretrieve() urllib.urlclea ...
- 用dd命令复制磁盘分区
用dd命令复制磁盘分区 首先是复制 复制前对写入的分区执行umount操作 sudo dd if=/dev/sda1 of=/dev/sda2 可以在另外一个终端输入这句,然后在原来的dd终端看到进度 ...
- sudo 添加
sudo 添加 /etc/sudoers 找到root ALL=(ALL) ALL那一行, 复制之后,修改用户名:
- 元素的数据存储-jQuery.data()与.data()
jQuery提供的存储接口 jQuery.data( element, key, value ) //静态接口,存数据 jQuery.data( element, key ) //静态接口,取数据 . ...
- 十分钟使用ionic Framework开发一个跨平台移动应用
Ionic是一个前端的框架,帮助开发人员使用HTML5, CSS3和JavaScript做出原生应用. ionic的理念类似前端开发的BootStrap,目标是封装HTML5移动跨平台开发的最佳实践. ...
- qt linux软件打包等
我的脚本: #!/bin/sh appname=`basename $0 | sed s,\.sh$,,` dirname=`dirname $0` tmp="${dirname#?}&qu ...
- ffmpeg的新东东:AVFilter
http://blog.csdn.net/niu_gao/article/details/7219641 利用ffmpeg做图像的pixel format转换你还在用libswscale吗?嘿嘿,过时 ...