您的位置:首页 > 其它

一些常用的宏定义

2014-08-13 14:19 281 查看
#define kScreenHeight [UIScreen mainScreen].bounds.size.height
//屏幕的高度
#define kScreenWidth [UIScreen mainScreen].bounds.size.width
//屏幕的宽度

//通过三色值获取颜色对象
#define rgb(r,g,b,a) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:a]
#define ColorWithImgName(str) [UIColor colorWithPatternImage:[UIImage imageNamed:str]]

//设备型号
#define SystemVersionFloat [[UIDevice currentDevice].systemVersion floatValue]

//判断字符串是否为空
#define strIsEmpty(str) (str == nil || [str length]<1 ? YES : NO )

//取文件
#define mainBundle(fileName,fileType) [[NSBundle mainBundle] pathForResource:fileName ofType:fileType]

//设置字体
#define sysFont(f) [UIFont systemFontOfSize:f]
#define boldSysFont(f) [UIFont boldSystemFontOfSize:f]
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: