#define IPHONE_X \({BOOLisPhoneX =NO;\if(@available(iOS11.0, *)) {\isPhoneX = [[UIApplicationsharedApplication] delegate].window.safeAreaInsets.bottom >0.0;\}\(isPhoneX);})链接:https://www.jianshu.com/p/a019f94c0a4f
// 判断是否是ipad
#defineisPad ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad)
判断是否x系类
#defineIS_IPhoneX_All ([UIScreen mainScreen].bounds.size.height == 812 || [UIScreen mainScreen].bounds.size.height == 896)
//状态栏、导航栏、标签栏高度#defineHeight_StatusBar [[UIApplication sharedApplication] statusBarFrame].size.height
#defineHeight_NavBar 44.0f
#defineHeight_TopBar (Height_StatusBar + Height_NavBar)
#defineHeight_TapBar (IS_IPhoneX_All ? 83.0f:49.0f)
#defineHeight_BottomSafe (IS_IPhoneX_All? 34.0f:0.0f)
#defineSCREEN_HEIGHTL
[UIScreen mainScreen].bounds.size.height#defineSCREEN_WIDTHL [UIScreen mainScreen].bounds.size.widt
#defineRGB16(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
#defineRGBAlpha(rgbValue,alphaValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:alphaValue]
#defineWeakSelf __weak typeof(self) weakSelf = self;
#define isEmpty(str) ([str isEqual:[NSNull null]] || str==nil || str.length==0 || [str isEqualToString:@"<null>"])
#define isNSNull(obj) ((NSNull *)obj == [NSNull null] || [obj isEqual:[NSNull null]] || obj==nil)
#define NON(str) (str?str:@"")
//判断iPHoneXr
#defineSCREENSIZE_IS_XR ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(828, 1792), [[UIScreen mainScreen] currentMode].size) && !UI_IS_IPAD : NO)
//判断iPHoneX、iPHoneXs
#defineSCREENSIZE_IS_X ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) && !UI_IS_IPAD : NO)
#defineSCREENSIZE_IS_XS ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) && !UI_IS_IPAD : NO)
//判断iPhoneXs Max
#defineSCREENSIZE_IS_XS_MAX ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242, 2688), [[UIScreen mainScreen] currentMode].size) && !UI_IS_IPAD : NO)
#defineIS_IPhoneX_All ([UIScreen mainScreen].bounds.size.height == 812 || [UIScreen mainScreen].bounds.size.height == 896)
作者:曹波波
链接:https://www.jianshu.com/p/7bfb1006b806
來源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。
链接:https://www.jianshu.com/p/7bfb1006b806
https://www.jianshu.com/p/0c03b95d8b59 xcode10 出现的问题