//屏幕尺寸
define SCREEN_WIDTH [UIScreen mainScreen].bounds.size.width
define SCREENH_HEIGHT [UIScreen mainScreen].bounds.size.height
//颜色
define RGB(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1.0]
define RGBA(r, g, b, a) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:(a)]
//(随机色)
define LRRandomColor [UIColor colorWithRed:arc4random_uniform(256)/255.0 green:arc4random_uniform(256)/255.0 blue:arc4random_uniform(256)/255.0 alpha:1.0]
//常用工具类
//(弱引用/强引用)
define LRWeakSelf(type) __weak typeof(type) weak##type = type;
define LRStrongSelf(type) __strong typeof(type) strong##type = weak##type;
//设置 view 圆角和边框
define LRViewBorderRadius(View, Radius, Width, Color)\
[View.layer setCornerRadius:(Radius)];
[View.layer setMasksToBounds:YES];
[View.layer setBorderWidth:(Width)];
[View.layer setBorderColor:[Color CGColor]]
//APP版本号
define kAppVersion [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]
//系统版本号
define kSystemVersion [[UIDevice currentDevice] systemVersion]
//获取当前语言
define kCurrentLanguage ([[NSLocale preferredLanguages] objectAtIndex:0])
//判断是否为iPhone
define IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
//判断是否为iPad
define IS_IPAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
//判断是否为ipod
网友评论