iOS屏幕尺寸和分辨率了解
1、截至目前为止,主流的iOS设备屏幕有以下几种:

--------------- iPhone ---------- -------- iPad ------------

2、iOS设备屏幕分辨率:(ppi是像素密度单位【像素/英寸】,401ppi表示每英寸上有401个像素)

ppi(pixel per inch)计算,以6Plus为例:
屏幕分辨率1920 x 1080, 屏幕尺寸5.5英寸(手机屏幕对角物理线的长度),
1920 x 1920 + 1080 x 1080 = 4852800, 开根号为:2202.907...
2202.907 / 5.5 = 400.528 ppi, 大约就是401ppi
3、iOS的三种分辨率
1)、资源分辨率:资源图片的大小,单位是像素。
2)、设计分辨率:逻辑上的屏幕大小,单位是点。我们在Interface Builder设计器中的单位和程序代码中的单位都是设计分辨率中的“点”。
3)、是以像素为单位的屏幕大小,所有的应用都会渲染到这个屏幕上展示给用户。
iPhone 6 Plus和 6S Plus是最为特殊的设备,资源分辨率与屏幕分辨率的比例是1.15 : 1, 而其他的设备比例是1 : 1。不同的人群关注的分辨率也是不同的,UI设计人员主要关注的是资源分辨率,开发人员主要关注的是设计分辨率,而一般用户主要关注的屏幕分辨率。

4、获取设备屏幕信息
获取当前移动设备对象:[UIDevice currentDevice]
UIDevice类所有信息
NS_CLASS_AVAILABLE_IOS(2_0) @interface UIDevice : NSObject + (UIDevice *)currentDevice; @property(nonatomic,readonly,strong) NSString *name; // e.g. "My iPhone"
@property(nonatomic,readonly,strong) NSString *model; // e.g. @"iPhone", @"iPod touch"
@property(nonatomic,readonly,strong) NSString *localizedModel; // localized version of model
@property(nonatomic,readonly,strong) NSString *systemName; // e.g. @"iOS"
@property(nonatomic,readonly,strong) NSString *systemVersion; // e.g. @"4.0"
@property(nonatomic,readonly) UIDeviceOrientation orientation __TVOS_PROHIBITED; // return current device orientation. this will return UIDeviceOrientationUnknown unless device orientation notifications are being generated. @property(nullable, nonatomic,readonly,strong) NSUUID *identifierForVendor NS_AVAILABLE_IOS(6_0); // a UUID that may be used to uniquely identify the device, same across apps from a single vendor. @property(nonatomic,readonly,getter=isGeneratingDeviceOrientationNotifications) BOOL generatesDeviceOrientationNotifications __TVOS_PROHIBITED;
- (void)beginGeneratingDeviceOrientationNotifications __TVOS_PROHIBITED; // nestable
- (void)endGeneratingDeviceOrientationNotifications __TVOS_PROHIBITED; @property(nonatomic,getter=isBatteryMonitoringEnabled) BOOL batteryMonitoringEnabled NS_AVAILABLE_IOS(3_0) __TVOS_PROHIBITED; // default is NO
@property(nonatomic,readonly) UIDeviceBatteryState batteryState NS_AVAILABLE_IOS(3_0) __TVOS_PROHIBITED; // UIDeviceBatteryStateUnknown if monitoring disabled
@property(nonatomic,readonly) float batteryLevel NS_AVAILABLE_IOS(3_0) __TVOS_PROHIBITED; // 0 .. 1.0. -1.0 if UIDeviceBatteryStateUnknown @property(nonatomic,getter=isProximityMonitoringEnabled) BOOL proximityMonitoringEnabled NS_AVAILABLE_IOS(3_0); // default is NO
@property(nonatomic,readonly) BOOL proximityState NS_AVAILABLE_IOS(3_0); // always returns NO if no proximity detector @property(nonatomic,readonly,getter=isMultitaskingSupported) BOOL multitaskingSupported NS_AVAILABLE_IOS(4_0); @property(nonatomic,readonly) UIUserInterfaceIdiom userInterfaceIdiom NS_AVAILABLE_IOS(3_2); - (void)playInputClick NS_AVAILABLE_IOS(4_2); // Plays a click only if an enabling input view is on-screen and user has enabled input clicks. @end
ios移动设备类型枚举判断:
typedef NS_ENUM(NSInteger, UIUserInterfaceIdiom) {
UIUserInterfaceIdiomUnspecified = -,
UIUserInterfaceIdiomPhone NS_ENUM_AVAILABLE_IOS(3_2), // iPhone and iPod touch style UI
UIUserInterfaceIdiomPad NS_ENUM_AVAILABLE_IOS(3_2), // iPad style UI
UIUserInterfaceIdiomTV NS_ENUM_AVAILABLE_IOS(9_0), // Apple TV style UI
};
[UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone // 表示iPhone设备
[UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad // 表示iPad设备
[UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomTV // 表示Apple TV设备
[UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomUnspecified // 表示未知设备
//示例:详细判断iPhone设备类型
//详细判断iPhone设备信息, 区分横屏和竖屏
if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone){
//获取屏幕尺寸信息
CGSize screenSize = [UIScreen mainScreen].bounds.size; //竖屏情况
if (screenSize.height > screenSize.width){
if (screenSize.height == ){
//iPhone 5/5S/5C (iPod / iPod touch) 等设备
}
else if (screenSize.height == ){
//iPone 6 / 6S 等设备
}
else if (screenSize.height == ){
//iPone 6 Plus / 6S Plus 等设备
}
else{
//iPhone 4 / 4S 等设备
}
} //横屏情况
if (screenSize.width > screenSize.height){
if (screenSize.width == ){
//iPhone 5/5S/5C (iPod / iPod touch) 等设备
}
else if (screenSize.width == ){
//iPone 6 / 6S 等设备
}
else if (screenSize.width == ){
//iPone 6 Plus / 6S Plus 等设备
}
else{
//iPhone 4 / 4S 等设备
}
}
}
//说明:在iPad和iPhone屏幕中,一般会有状态栏、标签栏、导航栏(或工具栏)以及内容视图部分,它们的尺寸也是固定的。状态栏占20点,导航栏占44点,标签栏占49点。
ppi(pixel per inch): 表示每英寸所包含的像素点数目,数值越高,屏幕能以更高密度显示图像
dpr(device pixel ratio): 设备像素比,设备像素 / 设备独立像素,表示设备独立像素到设备像素的转换关系
版权声明
作者:TDX
出处:博客园TDX的技术博客--http://www.cnblogs.com/tandaxia
您的支持是对博主最大的鼓励,感谢您的认真阅读。
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
iOS屏幕尺寸和分辨率了解的更多相关文章
- iOS屏幕尺寸和分辨率
iOS平台家族成员主要包括iPhone.iPod Touch和iPad,但是各类设备的分辨率各不相同,目前存在的尺寸主要有: iOS设备的尺寸多种多样,此外,屏幕的分辨率也有多种,总结如下表所示: 其 ...
- IOS 屏幕尺寸、分辨率、点之间的相互关系
iOS 设备现有的分辨率如下:iPhone/iPod Touch普通屏 320像素 x 480像素 iPhone 1.3G.3GS,iPod ...
- IOS 判断设备屏幕尺寸、分辨率
根据屏幕尺寸和分辨率,ios现在数起来有6个版本. iOS 设备现有的分辨率如下: iPhone/iPod Touch 普通屏 320像素 x 480像素 iPhone .3G.3GS,iPod To ...
- ios设备屏幕尺寸与分辨率
iOS 设备的屏幕尺寸.分辨率及其屏幕边长比例详细情况是怎样的? 根据屏幕尺寸和分辨率,ios现在数起来有6个版本.一,3GS:二,4s为代表:三,iphone5:四,ipad2为代表:五,ipad4 ...
- iosiPhone屏幕尺寸、分辨率及适配
iosiPhone屏幕尺寸.分辨率及适配 1.iPhone尺寸规格 设备 iPhone 宽 Width 高 Height 对角线 Diagonal 逻辑分辨率(point) Scale Fac ...
- iPhone屏幕尺寸、分辨率及适配
转:http://blog.csdn.net/phunxm/article/details/42174937 目录(?)[+] 1.iPhone尺寸规格 设备 iPhone 宽 Width 高 H ...
- 【转】iPhone屏幕尺寸、分辨率及适配
原文网址:http://blog.csdn.net/phunxm/article/details/42174937 1.iPhone尺寸规格 设备 iPhone 宽 Width 高 Height 对角 ...
- iPhone手机的屏幕尺寸、分辨率及适配
1.iPhone尺寸规格 设备 iPhone 宽 Width 高 Height 对角线 Diagonal 逻辑分辨率(point) Scale Factor 设备分辨率(pixel) PPI 3GS ...
- 【转载】iPhone屏幕尺寸、分辨率及适配
iPhone屏幕尺寸.分辨率及适配 转载http://m.blog.csdn.net/article/details?id=42174937 1.iPhone尺寸规格 iPhone 整机宽度Width ...
随机推荐
- 深入理解DOM事件机制系列第二篇——事件处理程序
× 目录 [1]HTML [2]DOM0级 [3]DOM2级[4]IE[5]总结 前面的话 事件处理程序又叫事件侦听器,实际上就是事件的绑定函数.事件发生时会执行函数中相应代码.事件处理程序有HTML ...
- ASP.NET MVC下的四种验证编程方式
ASP.NET MVC采用Model绑定为目标Action生成了相应的参数列表,但是在真正执行目标Action方法之前,还需要对绑定的参数实施验证以确保其有效性,我们将针对参数的验证成为Model绑定 ...
- tn文本分析语言(三):高级语法
标签(空格分隔): 未分类 高级操作 1.脚本表达式 用双引号包含的脚本被称为脚本表达式,目前支持嵌入Python. 脚本表达式只能在顺序表达式中使用.代码可以在三个位置存在: |位置|功能|例子| ...
- C#:lock锁与订单号(或交易号)的生成
在弄电商类网站的时候,往往是根据年月日时分秒的格式生成订单号(yyyyMMddHHmmss),为了解决并发性,就直接在生成订单号的区域块加上lock. 下面,我们来简单测试一下. 1.新建项目(控制台 ...
- iOS开发之山寨版新浪微博小结
在之前的博客IOS开发之新浪围脖中获取微博的内容是使用我自己的access_token来请求的数据,那么如何让其他用户也能登陆并获取自己的微博内容呢?接下来就是OAuth和SSO出场的时候啦.OAut ...
- 恢复MySQL主从数据一致性的总结
今日上午,同事告知,MySQL主从数据库的数据不一致,猜测备库在同步过程中出现了问题,于是,登上备库,使用 mysql> show slave status\G查看,果然,备库在insert语句 ...
- 【HBase】HBase Getting Started(HBase 入门指南)
入门指南 1. 简介 Quickstart 会让你启动和运行一个单节点单机HBase. 2. 快速启动 – 单点HBase 这部分描述单节点单机HBase的配置.一个单例拥有所有的HBase守护线程- ...
- C++ 与 php 的交互 之----- C++ 获取 网页文字内容,获取 php 的 echo 值。
转载请声明出处! http://www.cnblogs.com/linguanh/category/633252.html 距离上次 谈 C++ 制作json 或者其他数据传送给 服务器,时隔两个多月 ...
- 【Java心得总结三】Java泛型上——初识泛型
一.函数参数与泛型比较 泛型(generics),从字面的意思理解就是泛化的类型,即参数化类型.泛型的作用是什么,这里与函数参数做一个比较: 无参数的函数: public int[] newIntAr ...
- Android 源码下载方法(Git 方式clone)
Android源码对于Android开发者来说,迟早有一天你会用到的,所以就记录一下,分享给读者,希望对读者有用 这里需要使用到Git相关知识,不清楚的可以先阅读,了解的可以跳过 Git-Tortoi ...