iOS常用宏定义
2016-05-24 10:44
441 查看
#define fontSize(size) [UIFont systemFontOfSize:size] #define screenW [UIScreen mainScreen].bounds.size.width #define screenH [UIScreen mainScreen].bounds.size.height #define GRedColor [UIColor redColor] #define GBlueColor [UIColor blueColor] #define GCyanColor [UIColor cyanColor] #define GGreenColor [UIColor greenColor] #define GOrangeColor [UIColor orangeColor] #define GPurpleColor [UIColor purpleColor] #define GWhiteColor [UIColor whiteColor] #define GBlackColor [UIColor blackColor] #define GYellowColor [UIColor yellowColor] #define GLightGrayColor [UIColor lightGrayColor] #define GClearColor [UIColor clearColor] #define WAColor(W,A) [UIColor colorWithWhite:W alpha:A] #define RGBColor(R,G,B) [UIColor colorWithRed:R/255.0 green:G/255.0 blue:B/255.0 alpha:1] #define RandomColor [UIColor colorWithRed:arc4random_uniform(255)/255.0 green:arc4random_uniform(255)/255.0 blue:arc4random_uniform(255)/255.0 alpha:1] #define BundleID [[NSBundle mainBundle] bundleIdentifier] #define BundleID [[NSBundle mainBundle] infoDictionary][(id)kCFBundleIdentifierKey] #define BundleName [[NSBundle mainBundle] infoDictionary][(id)kCFBundleNameKey] #define BundleVersion [[NSBundle mainBundle] infoDictionary][@"CFBundleShortVersionString"] #define BundleBuild [[NSBundle mainBundle] infoDictionary][@"CFBundleVersion"] #define deviceType [[UIDevice currentDevice] model] #define iOSVersion [[[UIDevice currentDevice] systemVersion] intValue] #define isPhone4 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size) : NO) #define isPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO) #define isPhone6 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(750, 1334), [[UIScreen mainScreen] currentMode].size) : NO) #define isPhone6Plus ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242,2208), [[UIScreen mainScreen] currentMode].size) : NO) #define isPad (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
相关文章推荐
- ios三方库
- iOS NStimer 使用注意问题
- iOStableview CollectionView 自动滚动到制定行
- iOS瀑布流Demo
- iOS- 弹蒙层
- iOS代码技巧之判断设备及状态
- iOS图片动态缓存方案
- iOS学习之——浅复制和深复制
- iOS中的加号和减号方法
- iOS 插入广告
- iOS打测试包 打包上传
- <iOS>关于viewWithTag的一点说明
- 《Motion Design for iOS》(二十一)
- iOS学习之——init
- IOS缓存机制详解
- ios开发记录 :cocoapods 使用
- IOS 下载文件断点续传原理与实现(附源码)
- iOS 状态栏的颜色设置
- IOS 如何操作cookie
- 一键生成 ios 和安卓各尺寸截屏、图标