IOS开发中常用的 宏命令整理
2015-04-13 14:41
99 查看
// 版本判断
#define iOS7 SystemVersion >= 7
// 加载图片
#define LoadImage(PATH,TYPE) [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:PATH ofType:TYPE]]
// 创建TabBar集合
#define CREATE_TABARITEM(TITLE,PATH,TAG) [[[UITabBarItem alloc] initWithTitle:TITLE image:PATH tag:TAG] autorelease]
// 创建导航视图控制器
#define Create_Navigation(CONTROLLER) [[UINavigationController alloc] initWithRootViewController:CONTROLLER]
// 设置ARBG
#define ARGB(R,G,B,A) [UIColor colorWithRed:R / 255.0 green:G / 255.0 blue:B / 255.0 alpha:A]
// 清空颜色
#define CLEARCOLOR [UIColor clearColor]
// 设置图像为填充色
#define ImageColor(PATH,TYPE) [UIColor colorWithPatternImage:LoadImage(PATH,TYPE)]
// 设置字体大小
#define FONT_WITH_SIZE(SIZE) [UIFont systemFontOfSize:SIZE]
// 创建导航条自定义按钮
#define CUSTOMVIEW(VIEW) [[UIBarButtonItem alloc] initWithCustomView:VIEW]
// 角度旋转
#define DegressToRadian(x) (M_PI * (x) / 180.0)
// AppDelegate
#define ApplicationDelegate (AppDelegate *)[[UIApplication sharedApplication] delegate]
// MainBundleKey
#define ObjectForBundleKey(Key) [[NSBundle mainBundle] objectForInfoDictionaryKey:Key]
// 屏幕宽度
#define ScreenWidth [UIScreen mainScreen].bounds.size.width
// 屏幕高度
#define ScreenHeight [UIScreen mainScreen].bounds.size.height
// 判断是否为iPhone5
#define iPhone5 ScreenHeight > 480
// 加载文件来自Bundle
#define FileForBundle(PATH, TYPE) [[NSBundle mainBundle] pathForResource:PATH ofType:TYPE]
// 项目主体颜色
#define MainColor [UIColor whiteColor]
// 系统版本
#define SystemVersion [[[UIDevice currentDevice] systemVersion] floatValue]
#define iOS7 SystemVersion >= 7
// 加载图片
#define LoadImage(PATH,TYPE) [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:PATH ofType:TYPE]]
// 创建TabBar集合
#define CREATE_TABARITEM(TITLE,PATH,TAG) [[[UITabBarItem alloc] initWithTitle:TITLE image:PATH tag:TAG] autorelease]
// 创建导航视图控制器
#define Create_Navigation(CONTROLLER) [[UINavigationController alloc] initWithRootViewController:CONTROLLER]
// 设置ARBG
#define ARGB(R,G,B,A) [UIColor colorWithRed:R / 255.0 green:G / 255.0 blue:B / 255.0 alpha:A]
// 清空颜色
#define CLEARCOLOR [UIColor clearColor]
// 设置图像为填充色
#define ImageColor(PATH,TYPE) [UIColor colorWithPatternImage:LoadImage(PATH,TYPE)]
// 设置字体大小
#define FONT_WITH_SIZE(SIZE) [UIFont systemFontOfSize:SIZE]
// 创建导航条自定义按钮
#define CUSTOMVIEW(VIEW) [[UIBarButtonItem alloc] initWithCustomView:VIEW]
// 角度旋转
#define DegressToRadian(x) (M_PI * (x) / 180.0)
// AppDelegate
#define ApplicationDelegate (AppDelegate *)[[UIApplication sharedApplication] delegate]
// MainBundleKey
#define ObjectForBundleKey(Key) [[NSBundle mainBundle] objectForInfoDictionaryKey:Key]
// 屏幕宽度
#define ScreenWidth [UIScreen mainScreen].bounds.size.width
// 屏幕高度
#define ScreenHeight [UIScreen mainScreen].bounds.size.height
// 判断是否为iPhone5
#define iPhone5 ScreenHeight > 480
// 加载文件来自Bundle
#define FileForBundle(PATH, TYPE) [[NSBundle mainBundle] pathForResource:PATH ofType:TYPE]
// 项目主体颜色
#define MainColor [UIColor whiteColor]
// 系统版本
#define SystemVersion [[[UIDevice currentDevice] systemVersion] floatValue]
相关文章推荐
- ios 开发,通讯录信息调用常用方法,这个比较全,不用再整理了;
- iOS 开发一些常用插件和第三方库的整理
- IOS开发-OC学习-常用功能代码片段整理
- iOS开发--整理常用的第三方资源
- 2014资料整理--IOS开发常用库
- iOS常用开发资源整理
- iOS开发常用代码片段整理
- ios 开发,通讯录信息调用常用方法,这个比较全,不用再整理了;
- iOS开发之17个常用代码整理
- 整理IOS开发常用小Tips
- iOS开发常用第三方库的整理
- iOS 开发中常用的第三方下载地址整理
- ios开发 17个常用代码整理
- ios 开发,通讯录信息调用常用方法,这个比较全,不用再整理了;
- ios 开发,通讯录信息调用常用方法,这个比较全,不用再整理了;
- iOS开发中UIImageView控件的常用操作整理
- iOS开发常用代码片段整理
- ios开发常用第三方库收集以及整理
- ios 开发,通讯录信息调用常用方法,这个比较全,不用再整理了
- 2014年整理的IOS开发常用库