import UIKit

class ViewController: UIViewController {

    override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib. var label = "1" //获取屏幕大小
let iOSDeviceScreenSize: CGSize = UIScreen.main.bounds.size NSLog("%@ x %@", iOSDeviceScreenSize.width, iOSDeviceScreenSize.height)
var s : NSString = NSString(format: "%@ x %@",iOSDeviceScreenSize.width,iOSDeviceScreenSize.height)
label = s as String //获取设备信息,判断是否为iphone
if (UIDevice.current.userInterfaceIdiom == UIUserInterfaceIdiom.phone) { //判断是否为竖屏
if (iOSDeviceScreenSize.height > iOSDeviceScreenSize.width){
if(iOSDeviceScreenSize.height == 568){
NSLog("iphone5/5s/5c/se")
} else if (iOSDeviceScreenSize.height == 667){
NSLog("iphone 6/6s/7/8")
} else if (iOSDeviceScreenSize.height == 736){
NSLog("iphone 6plus/6Splus/7plus/8plus ")
} else if (iOSDeviceScreenSize.height == 812){
NSLog("iphone X/XS ")
} else if (iOSDeviceScreenSize.height == 896){
NSLog("iphone XR/XSMax ")
} else {
NSLog("iphone4s....")
}
} if (iOSDeviceScreenSize.width > iOSDeviceScreenSize.height){
if(iOSDeviceScreenSize.width == 568){
NSLog("iphone5/5s/5c/se")
} else if (iOSDeviceScreenSize.width == 667){
NSLog("iphone 6/6s/7/8")
} else if (iOSDeviceScreenSize.width == 736){
NSLog("iphone 6plus/6Splus/7plus/8plus ")
} else if (iOSDeviceScreenSize.width == 812){
NSLog("iphone X/XS ")
} else if (iOSDeviceScreenSize.width == 896){
NSLog("iphone XR/XSMax ")
} else {
NSLog("iphone4s....")
}
} } } }

最新文章

  1. centos7 mysql数据库安装和配置
  2. VC++中操作XML(MFC、SDK)转
  3. eclipse-统计代码行数
  4. git无法clone远程代码库及git代理设置
  5. ISO 9141-2 and ISO 14230-2 INITIALIZATION and DATA TRANSFER
  6. TesserOCR训练
  7. session与cookie的关系
  8. 从0到上线开发企业级电商项目_前端_01_sublime使用技巧
  9. NullPointerException org.apache.commons.digester.Digester.getXMLReader(Digester.java:1058)
  10. UML图学习之二 类图
  11. ldconfig几个需要注意的地方
  12. Angular项目中核心模块core Module只加载一次的实现
  13. 用 Python分析朋友圈好友的签名
  14. P2P原理(转)
  15. WEB控件没有什么所谓好不好,而是用得好不好
  16. JS中的new操作符
  17. 03_ExeZZ.cpp
  18. COM中的几个基本概念
  19. 苹果没放弃手写笔 这样的iPad你想要吗?
  20. CMDB概述(二)

热门文章

  1. 个人永久性免费-Excel催化剂功能第101波-批量替换功能(增加正则及高性能替换能力)
  2. jsp页面中将CST时间格式化为年月日
  3. Adaboost原理推导
  4. Flutter初体验--环境搭建
  5. C#编程.循环的中断
  6. MYSQL主从复制、主主复制、双主多从配置
  7. ListActivity
  8. 使用ASM实现动态代理
  9. About dycf
  10. 搭建PowerDNS+LAP+NFS+MySQL主从半节点同步实现LAMP架构