根据屏幕判断设备型号
2015-10-23 14:53
183 查看
CGSize screenSize = [UIScreen mainScreen].bounds.size; // 如果是iPhone if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone) { // 竖屏情况 if (screenSize.height > screenSize.width) { if (screenSize.height == 568) { NSLog(@"当前为iPhone 5/5c/5s iPod Touch5 设备"); }else if (screenSize.height == 667) { NSLog(@"当前为iPhone6/6s设备"); }else if (screenSize.height == 736) { NSLog(@"当前为iPhone6 Plus/iPhone6s Plus 设备"); }else { NSLog(@"当前为iPhone4/4s 等其他设备"); } } // 横屏情况 if (screenSize.width > screenSize.height) { if (screenSize.width == 568) { NSLog(@"当前为iPhone 5/5c/5s iPod Touch5 设备"); }else if (screenSize.width == 667) { NSLog(@"当前为iPhone6/6s设备"); }else if (screenSize.width == 736) { NSLog(@"当前为iPhone6 Plus/iPhone6s Plus 设备"); }else { NSLog(@"当前为iPhone4/4s 等其他设备"); } } }
相关文章推荐
- PHP 写守护进程,实例分享
- JAVA基础知识之冒泡排序
- 扩展GridView控件——为内容项添加拖放及分组功能
- 推荐的Android学习资料
- 设计概念澄清
- Protocol Buffers介绍
- 对客户推荐产品模型+python代码
- leetcode@ [62/63] Unique Paths II
- servlet
- ubuntu14全屏设置
- 黑马程序员——反射Constructor类
- 算法小结
- org.apache.log4j.Logger详解
- 魅族手机 取消下拉悬停 解决方法
- Android编程实现获取标题栏、状态栏的高度、屏幕大小及模拟Home键的方法
- C++ 虚函数与纯虚函数的区别
- 实习日志-第3天
- iOS开发必备--环境变量配置(Debug & Release)
- ENUM
- jxl实现excel 导出