ios常用的宏定义(转载)
来源:互联网 发布:nba2k18ios捏脸数据 编辑:程序博客网 时间:2024/06/06 04:15
ios常用的宏定义
转载地址:http://blog.csdn.net/icetime17/article/details/50365307##将iOS开发中常用的宏定义整理如下,仅包含Objective-C。而对于Swift,不能使用宏,则可以定义全局函数或者extension。请参考博客iOS — 总结Swift中常用的全局函数和extension(持续更新中)。//// Macro.h//// Objective-C useful macro for Chris Hu//// App#define APP_VERSION [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]// System Version#define SYSTEM_VERSION ([[[UIDevice currentDevice] systemVersion] floatValue])#define SYSTEM_VERSION_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)#define SYSTEM_VERSION_HIGHER_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)#define SYSTEM_VERSION_EQUAL_TO_OR_HIGHER_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)#define SYSTEM_VERSION_LOWER_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)#define SYSTEM_VERSION_EQUAL_TO_OR_LOWER_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)// Color#define RGB(r,g,b) [UIColor colorWithRed:r / 255.f green:g / 255.f blue:b / 255.f alpha:1.f]#define RGBA(r,g,b,a) [UIColor colorWithRed:r / 255.f green:g / 255.f blue:b / 255.f alpha:a]#define RGB_HEX(hex) RGBA((float)((hex & 0xFF0000) >> 16),(float)((hex & 0xFF00) >> 8),(float)(hex & 0xFF),1.f)#define RGBA_HEX(hex,a) RGBA((float)((hex & 0xFF0000) >> 16),(float)((hex & 0xFF00) >> 8),(float)(hex & 0xFF),a)#define COLOR_LIGHT_BLUE RGB_HEX(0x7f8b97)#define COLOR_DEEP_BLUE RGB_HEX(0x00b3d6)// Language#define CURRENT_LANGUAGE ([[NSLocale preferredLanguages] objectAtIndex:0])#define IS_LANGUAGE(l) [CURRENT_LANGUAGE hasPrefix:l]#define IS_LANGUAGE_EN IS_LANGUAGE(@"en")// Font#define FONT_SOFIA_MEDIUM(s) [UIFont fontWithName:@"SofiaProSoft-Medium" size:s]#define FONT_SOFIA_SOFT(s) [UIFont fontWithName:@"SofiaProSoft" size:s]// Screen#define SCREEN_SIZE [[UIScreen mainScreen] bounds].size#define SCREEN_WIDTH [[UIScreen mainScreen] bounds].size.width#define SCREEN_HEIGHT [[UIScreen mainScreen] bounds].size.height// GCD#define GCD_GLOBAL(block) dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), block)#define GCD_MAIN(block
阅读全文
0 0
- ios常用的宏定义(转载)
- iOS 常用的宏定义
- iOS 常用的宏定义
- ios 常用的宏定义
- iOS常用的宏定义
- iOS 常用的宏定义
- iOS 常用的宏定义
- IOS常用的宏定义
- ios常用的宏定义
- ios 常用的宏定义
- iOS 常用的宏定义
- iOS日常工作之常用宏定义大全【转载】
- IOS常用的定义
- IOS 常用宏定义
- iOS常用宏定义
- iOS 常用宏定义
- ios常用宏定义
- IOS 常用宏定义
- 进程学习12--alarm
- 深入探討DE2-70的『Error:Can't place pins assigned to pin location Pin_AD25 (IOC_X95_Y2_N1)』錯誤訊息的原因與解決方式
- WinAPI: DrawTextEx
- 贪心算法——活动安排
- Object::connect: No such slot 问题解决办法
- ios常用的宏定义(转载)
- php 获取今日、昨日、上周、本月的起始时间戳和结束时间戳的方法
- java实现定时任务的方法
- C#静态与非静态 类,成员、结构
- 社会实践调研报告-题目:大学生理财能力调查与分析
- 求欧拉函数
- 上传本地代码到GitHub
- SSH Client连接Ubuntu Server失败解法
- Android 5.0(Lollipop)事件输入系统(Input System)