IOS开发中常用的 宏命令整理

// 版本判断
#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]
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值