-
iPhone 各种机型尺寸信息列表入下表:
机型.png - 手机机型区分
/// 屏幕尺寸相关
#define BXF_SCREEN_WIDTH ([[UIScreen mainScreen] bounds].size.width)
#define BXF_SCREEN_HEIGHT ([[UIScreen mainScreen] bounds].size.height)
#define BXF_SCREEN_BOUNDS ([[UIScreen mainScreen] bounds])
#define BXF_SCREEN_MAX_LENGTH (MAX(BXF_SCREEN_WIDTH, BXF_SCREEN_HEIGHT))
#define BXF_SCREEN_MIN_LENGTH (MIN(BXF_SCREEN_WIDTH, BXF_SCREEN_HEIGHT))
/// 手机类型相关
#define BXF_IS_IPHONE_4_OR_LESS (BXF_IS_IPHONE && BXF_SCREEN_MAX_LENGTH < 568.0)
#define BXF_IS_IPHONE_5 (BXF_IS_IPHONE && BXF_SCREEN_MAX_LENGTH == 568.0)
#define BXF_IS_IPHONE_6 (BXF_IS_IPHONE && BXF_SCREEN_MAX_LENGTH == 667.0)
#define BXF_IS_IPHONE_6P (BXF_IS_IPHONE && BXF_SCREEN_MAX_LENGTH == 736.0)
#define BXF_IS_IPHONE_X (BXF_IS_IPHONE && BXF_SCREEN_MAX_LENGTH == 812.0)
//判断是否是ipad
#define isPad ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad)
//判断iPhone4系列
#define kiPhone4 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size) && !isPad : NO)
//判断iPhone5系列
#define kiPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) && !isPad : NO)
//判断iPhone6系列
#define kiPhone6 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(750, 1334), [[UIScreen mainScreen] currentMode].size) && !isPad : NO)
//判断iphone6+系列
#define kiPhone6Plus ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242, 2208), [[UIScreen mainScreen] currentMode].size) && !isPad : NO)
//判断iPhoneX
#define IS_IPHONE_X ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) && !isPad : NO)
//判断iPHoneXr
#define IS_IPHONE_Xr ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(828, 1792), [[UIScreen mainScreen] currentMode].size) && !isPad : NO)
//判断iPhoneXs
#define IS_IPHONE_Xs ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) && !isPad : NO)
//判断iPhoneXs Max
#define IS_IPHONE_Xs_Max ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242, 2688), [[UIScreen mainScreen] currentMode].size) && !isPad : NO)
//iPhoneX系列
#define Height_StatusBar ((IS_IPHONE_X==YES || IS_IPHONE_Xr ==YES || IS_IPHONE_Xs== YES || IS_IPHONE_Xs_Max== YES) ? 44.0 : 20.0)
#define BXF_APPLICATION_TOP_BAR_HEIGHT ((IS_IPHONE_X==YES || IS_IPHONE_Xr ==YES || IS_IPHONE_Xs== YES || IS_IPHONE_Xs_Max== YES) ? 88.0 : 64.0)
#define BXF_APPLICATION_TAB_BAR_HEIGHT ((IS_IPHONE_X==YES || IS_IPHONE_Xr ==YES || IS_IPHONE_Xs== YES || IS_IPHONE_Xs_Max== YES) ? 83.0 : 49.0)
#define BXF_APPLICATION_HOMEPAGED_ETAIlS_HEIGHT ((IS_IPHONE_X==YES || IS_IPHONE_Xr ==YES || IS_IPHONE_Xs== YES || IS_IPHONE_Xs_Max== YES) ? 230.0f:200.0f)
/// 工具条高度 (常见的高度)
#define BXF_APPLICATION_TOOL_BAR_HEIGHT_44 44.0f
#define BXF_APPLICATION_TOOL_BAR_HEIGHT_49 49.0f
/// 状态栏高度
#define BXF_APPLICATION_STATUS_BAR_HEIGHT (BXF_IS_IPHONE_X?44:20.0f)
网友评论