适配宏

2018-11-09  本文已影响11人  06f43b0b52f7

ifdef DEBUG

define NSLog(format, ...) printf("\n[%s] %s [第%d行] %s\n", TIME, FUNCTION, LINE, [[NSString stringWithFormat:format, ## VA_ARGS] UTF8String]);

else

define NSLog(format, ...)

endif

define UIColorFromRGB(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]

define KColorDefualt UIColorFromRGB(0x02DCCC)

define KImageNameDefualt [UIImage imageNamed:@"img_load"]

define kScreenWidth [UIScreen mainScreen].bounds.size.width

define kScreenHeight [UIScreen mainScreen].bounds.size.height

define kScreenWidthRatio (kScreenWidth / 375.0)

define kScreenHeightRatio (kScreenHeight / 667.0)

define AdaptedWidthValue(x) (ceilf((x) * kScreenWidthRatio))

define AdaptedHeightValue(x) (ceilf((x) * kScreenHeightRatio))

define kSystemFontWithSize(R) [UIFont systemFontOfSize:(AdaptedWidthValue(R))]

define IS_IPAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)

define kStatusBarHeight [[UIApplication sharedApplication] statusBarFrame].size.height

define kNavBarHeight (kStatusBarHeight + 44)

define NavBarHeight 44

define isiPhoneX (kScreenHeight > 736 ? (YES) : (NO))

define kTabBarHeight (IS_IPAD ? 0 : (isiPhoneX ? 83 : 49))

define kBottomHeight (IS_IPAD ? 0 : (isiPhoneX ? 34 : 0))

上一篇 下一篇

猜你喜欢

热点阅读