iPhone 系列
| 设备 | 尺寸 | 屏幕点(pt) | 物理像素(px) | retain |
|---|---|---|---|---|
| iPhone 4S | 3.5 | 320 x 480 | 960 x 640 | 2X |
| iPhone 5/5S/5C | 4 | 320 x 568 | 1136 x 640 | 2X |
| iPhone 6/6S | 4.7 | 375 x 667 | 1136 x 750 | 2X |
| iPhone 6/6S Plus | 5.5 | 414 x 736 | 2208 x 1242 | 3X |
| iPhone SE 1 | 4 | 320 x 568 | 1136 x 640 | 2X |
| iPhone 7 | 4.7 | 375 x 667 | 1334 x 750 | 2X |
| iPhone 7 Plus | 5.5 | 414 x 736 | 2208 x 1242 | 3X |
| iPhone 8 | 4.7 | 375 x 667 | 1334 x 750 | 2X |
| iPhone 8 Plus | 5.5 | 414 x 736 | 2208 x 1242 | 3X |
| iPhone X | 5.8 | 375 x 812 | 2436 x 1125 | 3X |
| iPhone XS | 5.8 | 375 x 812 | 2436 x 1125 | 3X |
| iPhone XS Max | 6.5 | 414 x 896 | 2688 x 1242 | 3X |
| iPhone SE 2 | 4.7 | 375 x 667 | 1334 x 750 | 2X |
| iPhone XR | 6.1 | 414 x 896 | 1792 x 828 | 2X |
| iPhone 11 | 6.1 | 414 x 896 | 1792 x 828 | 2X |
| iPhone 11 Pro | 5.8 | 375 x 812 | 2436 x 1125 | 3X |
| iPhone 11 Pro Max | 6.5 | 414 x 896 | 2688 x 1242 | 3X |
| iPhone 12 Mini | 5.4 | 360 x 780 | 2340 x 1080 | 3X |
| iPhone 12 | 6.1 | 390 x 844 | 2532 x 1170 | 3X |
| iPhone 12 Pro | 6.1 | 390 x 844 | 2532 x 1170 | 3X |
| iPhone 12 Pro Max | 6.7 | 428 x 926 | 2778 x 1284 | 3X |
| iPhone 13 Mini | 5.4 | 360 x 780 | 2340 x 1080 | 3X |
| iPhone 13 | 6.1 | 390 x 844 | 2532 x 1170 | 3X |
| iPhone 13 Pro | 6.1 | 390 x 844 | 2532 x 1170 | 3X |
| iPhone 13 Pro Max | 6.7 | 428 x 926 | 2778 x 1284 | 3X |
尺寸宏:
#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)
如果文章对你有所帮助,记得给个赞呦!