iPhone 屏幕尺寸及适配

1,956 阅读2分钟

Apple设备型号

iPhone 系列

设备尺寸屏幕点(pt)物理像素(px)retain
iPhone 4S3.5320 x 480960 x 6402X
iPhone 5/5S/5C4320 x 5681136 x 6402X
iPhone 6/6S4.7375 x 6671136 x 7502X
iPhone 6/6S Plus5.5414 x 7362208 x 12423X
iPhone SE 14320 x 5681136 x 6402X
iPhone 74.7375 x 6671334 x 7502X
iPhone 7 Plus5.5414 x 7362208 x 12423X
iPhone 84.7375 x 6671334 x 7502X
iPhone 8 Plus5.5414 x 7362208 x 12423X
iPhone X5.8375 x 8122436 x 11253X
iPhone XS5.8375 x 8122436 x 11253X
iPhone XS Max6.5414 x 8962688 x 12423X
iPhone SE 24.7375 x 6671334 x 7502X
iPhone XR6.1414 x 8961792 x 8282X
iPhone 116.1414 x 8961792 x 8282X
iPhone 11 Pro5.8375 x 8122436 x 11253X
iPhone 11 Pro Max6.5414 x 8962688 x 12423X
iPhone 12 Mini5.4360 x 7802340 x 10803X
iPhone 126.1390 x 8442532 x 11703X
iPhone 12 Pro6.1390 x 8442532 x 11703X
iPhone 12 Pro Max6.7428 x 9262778 x 12843X
iPhone 13 Mini5.4360 x 7802340 x 10803X
iPhone 136.1390 x 8442532 x 11703X
iPhone 13 Pro6.1390 x 8442532 x 11703X
iPhone 13 Pro Max6.7428 x 9262778 x 12843X

尺寸宏:

#define IS_PhoneXAll \
    ({ BOOL IS_PhoneXAll = NO; \
       if (@available(iOS 11.0, *)) { \
           IS_PhoneXAll = [[UIApplication sharedApplication] delegate].window.safeAreaInsets.bottom > 0.0; \
       } \
       (IS_PhoneXAll); })

/// 屏幕宽、高
#define kScreenWidth         [UIScreen mainScreen].bounds.size.width
#define kScreenHeight        [UIScreen mainScreen].bounds.size.height
/// 状态栏高度
#define kStateBarHeight      [[UIApplication sharedApplication] statusBarFrame].size.height
/// 导航栏高度
#define kNavigationBarHeight kStateBarHeight + 44
/// 底部tabbar高度
#define kTabBarHeight        (IS_PhoneXAll ? (49.0 + 34.0) : 49.0)
/// 底部安全距离
#define kSafeBottomHeight    (IS_PhoneXAll ? 34.0 : 0)

如果文章对你有所帮助,记得给个赞呦!