[UIApplication sharedApplication].applicationIconBadgeNumber = 0; // 清空 App 图标的未读推送消息个数
宏
#define RGB(A, B, C) [UIColor colorWithRed:A/255.0 green:B/255.0 blue:C/255.0 alpha:1.0] // 自定义 RGB 颜色
#define kScreenWidth [UIScreen mainScreen].bounds.size.width // 屏幕宽度
#define kScreenHeight [UIScreen mainScreen].bounds.size.height // 屏幕高度
// 只在 Debug 下,打印 Log
#ifdef DEBUG
#define debugLog(...) NSLog(__VA_ARGS__)
#define debugMethod() NSLog(@"%s", __func__)
#else
#define debugLog(...)
#define debugMetohd()
#endif
#define is_iPhone (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) // 判断 iPhone
#define is_iPad (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) // 判断 iPad
#define is_AppleTV (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomTV) // 判断 AppleTV
#define is_CarPlay (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomCarPlay) // 判断 CarPlay
#define is_Unspecified (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomUnspecified) // 判断 未知设备
计算
// 四舍五入
extern float roundf(float);
extern double round(double);
extern long double roundl(long double);
// 向下取整
extern float floorf(float);
extern double floor(double);
extern long double floorl(long double);
// 向上取整
extern float ceilf(float);
extern double ceil(double);
extern long double ceill(long double);
显示
self.automaticallyAdjustsScrollViewInsets = NO; // 自动设置内边距,默认为 YES