iOS 苹果设备尺寸 swift

/**
 设备名称                                                       屏幕尺寸    像素          点
 Phone 2G \ iPhone 3G \ iPhone 3GS                              3.5″    320*480    320*480 @1x
 iPhone 4 \ iPhone 4S                                           3.5″    640*960    320*480 @2x
 iPhone 5 \ iPhone 5C \ iPhone 5S \ iPhone SE(一代)               4″     640*1136    320*568 @2x
 iPhone 6 \ iPhone 6S \ iPhone 7 \ iPhone 8 \ iPhone SE(二代)    4.7″    750*1334    375*667 @2x
 iPhone 6+ \ iPhone 6S+ \ iPhone 7+ \ iPhone 8+                 5.5″    1242*2208    414*736 @3x
 iPhone X \ iPhone XS \ iPhone 11 Pro                           5.8″    1125*2436    375*812 @3x
 iPhone XR \ iPhone 11                                          6.1″    828*1792    414*896 @2x
 iPhone XS Max \ iPhone 11 Pro Max                              6.5″    1242*2688    414*896 @3x
 iPhone 12 mini                                                 5.4″    1080*2340    360*780 @3x
 iPhone 12 \ iPhone 12 Pro                                      6.1″    1170*2532    390*844 @3x
 iPhone 12 Pro Max                                              6.7″    1284*2778    428*926 @3x
 
 状态栏高度

 非全面屏:20pt
 全面屏:44pt
 安全区域高度:34pt
 
 */

/**
 判断是否是ipad
 */
let isPad = UIDevice.current.userInterfaceIdiom == UIUserInterfaceIdiom.pad

/**
机型的屏幕大小
*/
let Device_iPhoneX = __CGSizeEqualToSize(CGSize.init(width: 1125/3, height: 2436/3), UIScreen.main.bounds.size)

let Device_iPhoneXr = __CGSizeEqualToSize(CGSize.init(width: 828/2, height: 1792/2), UIScreen.main.bounds.size)

let Device_iPhoneXs = __CGSizeEqualToSize(CGSize.init(width: 1125/3, height: 2436/3), UIScreen.main.bounds.size)

let Device_iPhoneXs_Max = __CGSizeEqualToSize(CGSize.init(width: 1242/3, height: 2688/3), UIScreen.main.bounds.size)

let Device_iPhone_12_mini = __CGSizeEqualToSize(CGSize.init(width: 1080/3, height: 2340/3), UIScreen.main.bounds.size)

let Device_iPhone_12 = __CGSizeEqualToSize(CGSize.init(width: 1170/3, height: 2532/3), UIScreen.main.bounds.size)

let Device_iPhone_12_Pro_Max = __CGSizeEqualToSize(CGSize.init(width: 1282/3, height: 2778/3), UIScreen.main.bounds.size)

let isIphone_12_Type = (Device_iPhone_12_mini || Device_iPhone_12 || Device_iPhone_12_Pro_Max)

let isIphoneX_Type = (Device_iPhoneX || Device_iPhoneXr || Device_iPhoneXs || Device_iPhoneXs_Max || isIphone_12_Type)
/**
状态栏高度
*/
let kDevice_StateBarHight: CGFloat = (isIphoneX_Type ? 44:20)
/**
顶部状态栏+导航高度
*/
let kDevice_TopSpaceHight: CGFloat = (isIphoneX_Type ? 88:64)
/**
底部安全区域的高度
*/
let kDevice_BottomSafeHeight: CGFloat = (isIphoneX_Type ? 34:0)

/**
 手机屏幕宽度
 */
let kDevice_Width = UIScreen.main.bounds.size.width

/**
手机屏幕高度
*/
let kDevice_Hight = UIScreen.main.bounds.size.height

你可能感兴趣的:(iOS 苹果设备尺寸 swift)