一些常用的宏定义

来源:互联网 发布:网络直销怎么做 2017 编辑:程序博客网 时间:2024/05/19 03:27

#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]


0 0
原创粉丝点击