// // NTESGlobalMacro.h // NIMDemo // // Created by chris on 15/2/12. // Copyright (c) 2015年 Netease. All rights reserved. // #ifndef NIMDemo_GlobalMacro_h #define NIMDemo_GlobalMacro_h #define IOS11 ([[[UIDevice currentDevice] systemVersion] doubleValue] >= 11.0) #define UIScreenWidth [UIScreen mainScreen].bounds.size.width #define UIScreenHeight [UIScreen mainScreen].bounds.size.height #define UISreenWidthScale UIScreenWidth / 320 #define UICommonTableBkgColor UIColorFromRGB(0xe4e7ec) #define Message_Font_Size 14 // 普通聊天文字大小 #define Notification_Font_Size 10 // 通知文字大小 #define Chatroom_Message_Font_Size 16 // 聊天室聊天文字大小 #define SuppressPerformSelectorLeakWarning(Stuff) \ do { \ _Pragma("clang diagnostic push") \ _Pragma("clang diagnostic ignored \"-Warc-performSelector-leaks\"") \ Stuff; \ _Pragma("clang diagnostic pop") \ } while (0) #pragma mark - UIColor宏定义 #define UIColorFromRGBA(rgbValue, alphaValue) [UIColor \ colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \ green:((float)((rgbValue & 0x00FF00) >> 8))/255.0 \ blue:((float)(rgbValue & 0x0000FF))/255.0 \ alpha:alphaValue] #define UIColorFromRGB(rgbValue) UIColorFromRGBA(rgbValue, 1.0) #define dispatch_sync_main_safe(block)\ if ([NSThread isMainThread]) {\ block();\ } else {\ dispatch_sync(dispatch_get_main_queue(), block);\ } #define dispatch_async_main_safe(block)\ if ([NSThread isMainThread]) {\ block();\ } else {\ dispatch_async(dispatch_get_main_queue(), block);\ } /* weakSelf strongSelf reference */ #define WEAK_SELF(weakSelf) __weak __typeof(&*self) weakSelf = self; #define STRONG_SELF(strongSelf) __strong __typeof(&*weakSelf) strongSelf = weakSelf; #endif