123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- #import <Availability.h>
- #ifndef __IPHONE_5_0
- #warning "This project uses features only available in iOS SDK 5.0 and later."
- #endif
- #ifdef __OBJC__
- @import UIKit;
- @import Foundation;
- @import Masonry;
- #import "CMWarnHUD.h"
- #import <PBSDK/PBNetwork.h>
- #import <PBSDK/PBLogLocalTools.h>
- #endif
- #define WeakSelf __weak __typeof(&*self)weakSelf = self;
- #define W [UIScreen mainScreen].bounds.size.width/375.0
- #define screenWidth [UIScreen mainScreen].bounds.size.width
- #define screenHeight [UIScreen mainScreen].bounds.size.height
- #define rgba(r,g,b,a) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:(a)]
- #define safeBarHeight [UIApplication sharedApplication].windows.firstObject.safeAreaInsets.top
- #define safeBottomHeight [UIApplication sharedApplication].windows.firstObject.safeAreaInsets.bottom
- #define UIFONT(key) [UIFont systemFontOfSize:(key)]
- #define UIBOLDFONT(key) [UIFont boldSystemFontOfSize:(key)]
- #define SafeBlock(BlockName, ...) ({ !BlockName ? nil : BlockName(__VA_ARGS__); })
- #ifndef __OPTIMIZE__
- #define NSLog(format,...) fprintf(stderr, "时间:%s %s\n", __TIME__, [[NSString stringWithFormat:(format), ##__VA_ARGS__] UTF8String])
- #else
- #define NSLog(...) NSLog(@"")
- #endif
- #define kWeakSelf(type) __weak typeof(type) weak##type = type;
- #define kStrongSelf(type) __strong typeof(type) type = weak##type;
- #define kSafeBottomMargin \
- ({CGFloat safeBottomMargin = 0; \
- if (@available(iOS 11.0, *)) { \
- UIWindow *keyWindow = [[[UIApplication sharedApplication] delegate] window]; \
- safeBottomMargin = keyWindow.safeAreaInsets.bottom; \
- } \
- (safeBottomMargin); \
- })
- #define kSafeTopMargin \
- ({CGFloat safeTopMargin = 0; \
- if (@available(iOS 11.0, *)) { \
- UIWindow *keyWindow = [[[UIApplication sharedApplication] delegate] window]; \
- safeTopMargin = keyWindow.safeAreaInsets.top; \
- } \
- (safeTopMargin); \
- })
- #define kSafeRightMargin \
- ({CGFloat safeBottomMargin = 0; \
- if (@available(iOS 11.0, *)) { \
- UIWindow *keyWindow = [[[UIApplication sharedApplication] delegate] window]; \
- safeBottomMargin = keyWindow.safeAreaInsets.right; \
- } \
- (safeBottomMargin); \
- })
- #define kSafeLeftMargin \
- ({CGFloat safeBottomMargin = 0; \
- if (@available(iOS 11.0, *)) { \
- UIWindow *keyWindow = [[[UIApplication sharedApplication] delegate] window]; \
- safeBottomMargin = keyWindow.safeAreaInsets.left; \
- } \
- (safeBottomMargin); \
- })
|