//屏幕宽高
#define SCREEN_WIDTH ([UIScreen mainScreen].bounds).size.width
#define SCREEN_HEIGHT ([UIScreen mainScreen].bounds).size.height
// iOS 系统版本
#define IOS_VERSION [[[UIDevice currentDevice] systemVersion] floatValue]
//几种屏幕的尺寸
#define KDevice_IS_iPhone4s ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size) : NO)
#define KDevice_IS_iPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)
#define KDevice_IS_iPhone6 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(750, 1334), [[UIScreen mainScreen] currentMode].size) : NO)
#define KDevice_IS_iPhone6Plus ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242, 2208), [[UIScreen mainScreen] currentMode].size) : NO)
//屏幕比例
#define KWIDTH_6PLUS_SCALE [UIScreen mainScreen].bounds.size.width/414.0f
#define KHEIGHT_6PLUS_SCALE [UIScreen mainScreen].bounds.size.height/736.0f
#define KWIDTH_IPHONE6_SCALE [UIScreen mainScreen].bounds.size.width/375.0f
#define KHEIGHT_IPHONE6_SCALE [UIScreen mainScreen].bounds.size.height/667.0f
#define KWIDTH_IPHONE5_SCALE [UIScreen mainScreen].bounds.size.width/320.0f
#define KHEIGHT_IPHONE5_SCALE [UIScreen mainScreen].bounds.size.height/568.0f
//NavBar高度
#define NAVIGATION_HEIGHT_44 44
//NavBar高度 + statusBar高度
#define NAVIGATION_HEIGHT_64 64
//TabBar高度
#define TABAR_HEIGHT_49 49
//常用cell高度
#define CELLS_HEIGHT 44
//RGB 色值 以及 alpha值
#define RGBA(r, g, b,a) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:a]
#define RGB(r, g, b) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:1]
// RGB 颜色转换(16进制->10进制)
#define RGB_VALUE(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]
// NSUserDefaults
#define USER_DEFAULT [NSUserDefaults standardUserDefaults]
//字体的设置
#define SYSTEM_FONT(f) [UIFont systemFontOfSize:f]
#define BOLD_FONT(f) [UIFont boldSystemFontOfSize:f]
//重写Debug模式下打印日
#ifdef DEBUG
#define DebugLog(format, ...) printf("\n[%s] %s [第%d行] %s\n", __TIME__, __FUNCTION__, __LINE__, [[NSString stringWithFormat:format, ## __VA_ARGS__] UTF8String]);
#else
#define DebugLog(...)
#endif
//AppDelegate
#define SHARE_APP ((AppDelegate *)[[UIApplication sharedApplication] delegate])
//获取当前的类
#define CURRENT_ClASS NSStringFromClass([self class]
//弱引用
#define weakSelf(weakSelf) __weak __typeof(&*self)weakSelf = self;
#endif /* App_pch */
常用PCH文件
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...