1. 程式人生 > >iPhone X 適配

iPhone X 適配

// iPhoneX適配
#define Is_Iphone (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
#define Is_Iphone_X (Is_Iphone && kScreenHeight == 812.0)
// 狀態列高度
#define kStatusHeight (Is_Iphone_X ? 44 : 20)
// 導航欄高度
#define kNavigationHeight 44
// 底部弧線高度(iPhoneX 才有)
#define kBottomHeight (Is_Iphone_X ? 34 : 0)
// 頂部狀態列+導航欄
#define kTopSubHeight (Is_Iphone_X ? 88 : 64)
// tabbar高度
#define kTabBarHeight (Is_Iphone_X ? 83 : 49)
///螢幕比例  相對於6s計算
#define KProX [UIScreen mainScreen].bounds.size.width/375
#define KProY [UIScreen mainScreen].bounds.size.height/667

就是用view的widthkProXy, heightkProY