获取iPhone各个版本屏幕大小
2016-04-22 10:56
537 查看
IOS的开发现在在屏幕的适配上比较麻烦,下面就来了解下各个iPhone的屏幕大小,获取屏幕大小和状态栏的代码如下:
iPhone 4S 320x480 3.5‘
//整个屏幕的大小 CGRect rc = [[UIScreen mainScreen] bounds]; NSLog(@"bounds x = %f, y = %f, width = %f, height = %f", rc.origin.x, rc.origin.y, rc.size.width, rc.size.height); //可用区域的大小 CGRect rc1 = [UIScreen mainScreen].applicationFrame; NSLog(@"applicationFrame x = %f, y = %f, width = %f, height = %f", rc1.origin.x, rc1.origin.y, rc1.size.width, rc1.size.height); //状态栏的大小 CGRect barRc = [[UIApplication sharedApplication] statusBarFrame]; NSLog(@"statusBarFrame x = %f, y = %f, width = %f, height = %f", barRc.origin.x, barRc.origin.y, barRc.size.width, barRc.size.height);现在就就将主流的iPhone手机屏幕打印出来
iPhone 4S 320x480 3.5‘
2016-04-22 10:25:56.437 bounds x = 0.000000, y = 0.000000, width = 320.000000, height = 480.000000 2016-04-22 10:25:56.438 applicationFrame x = 0.000000, y = 20.000000, width = 320.000000, height = 460.000000 2016-04-22 10:25:56.438 statusBarFrame x = 0.000000, y = 0.000000, width = 320.000000, height = 20.000000iPhone 5 320x568 4.0’
2016-04-22 10:43:18.905 bounds x = 0.000000, y = 0.000000, width = 320.000000, height = 568.000000 2016-04-22 10:43:18.906 applicationFrame x = 0.000000, y = 20.000000, width = 320.000000, height = 548.000000 2016-04-22 10:43:18.906 statusBarFrame x = 0.000000, y = 0.000000, width = 320.000000, height = 20.000000iPhone 5S 320x568 4.0‘
2016-04-22 10:45:06.661 bounds x = 0.000000, y = 0.000000, width = 320.000000, height = 568.000000 2016-04-22 10:45:06.662 applicationFrame x = 0.000000, y = 20.000000, width = 320.000000, height = 548.000000 2016-04-22 10:45:06.662 statusBarFrame x = 0.000000, y = 0.000000, width = 320.000000, height = 20.000000iPhone 6 375x667 4.7’
2016-04-22 10:47:22.315 bounds x = 0.000000, y = 0.000000, width = 375.000000, height = 667.000000 2016-04-22 10:47:22.316 applicationFrame x = 0.000000, y = 20.000000, width = 375.000000, height = 647.000000 2016-04-22 10:47:22.316 statusBarFrame x = 0.000000, y = 0.000000, width = 375.000000, height = 20.000000iPhone 6 Plus 414x736 5.5‘
2016-04-22 10:48:46.672 bounds x = 0.000000, y = 0.000000, width = 414.000000, height = 736.000000 2016-04-22 10:48:46.672 applicationFrame x = 0.000000, y = 20.000000, width = 414.000000, height = 716.000000 2016-04-22 10:48:46.673 statusBarFrame x = 0.000000, y = 0.000000, width = 414.000000, height = 20.000000iPhone 6S 375x667 4.7’
2016-04-22 10:50:55.777 bounds x = 0.000000, y = 0.000000, width = 375.000000, height = 667.000000 2016-04-22 10:50:55.778 applicationFrame x = 0.000000, y = 20.000000, width = 375.000000, height = 647.000000 2016-04-22 10:50:55.778 statusBarFrame x = 0.000000, y = 0.000000, width = 375.000000, height = 20.000000iPhone 6S Plus 414x736 5.5‘
2016-04-22 10:52:15.132 bounds x = 0.000000, y = 0.000000, width = 414.000000, height = 736.000000 2016-04-22 10:52:15.133 applicationFrame x = 0.000000, y = 20.000000, width = 414.000000, height = 716.000000 2016-04-22 10:52:15.133 statusBarFrame x = 0.000000, y = 0.000000, width = 414.000000, height = 20.000000CGRect rc1 = [UIScreen mainScreen].applicationFrame;这个方法在IOS9.0以上已经过时了,建议我们使用CGRect rc = [[UIScreen mainScreen] bounds];
相关文章推荐
- 峰回路转,Firefox 浏览器即将重返 iOS 平台
- 峰回路转,Firefox 浏览器即将重返 iOS 平台
- 不可修补的 iOS 漏洞可能导致 iPhone 4s 到 iPhone X 永久越狱
- 绝大部分 Android 手电筒应用需要大量权限
- iOS 12.4 系统遭黑客破解,漏洞危及数百万用户
- 这些看似合法的 iPhone Lightning 数据线将劫持您的电脑
- 每日安全资讯:NSO,一家专业入侵 iPhone 的神秘公司
- [转][源代码]Comex公布JailbreakMe 3.0源代码
- 我的iPhone桌面
- 三种检测iPhone/iPad设备方向的方法
- js实现iPhone界面风格的单选框和复选框按钮实例
- 讲解iOS开发中基本的定位功能实现
- iOS中定位当前位置坐标及转换为火星坐标的方法
- js判断客户端是iOS还是Android等移动终端的方法
- iOS应用中UISearchDisplayController搜索效果的用法
- IOS开发环境windows化攻略