宏定义

2016-12-05  本文已影响0人  守护浪漫的小香樟

#define ScreenWidth  [UIScreen mainScreen].bounds.size.width

#define ScreenHeight  [UIScreen mainScreen].bounds.size.height

#define SizeScaleX    ((ScreenHeight > 480) ? (ScreenWidth/320) : 1.0)

#define SizeScaleY    ((ScreenHeight > 480) ? (ScreenHeight/568) : 1.0)

#define kiOSVersion  [[[UIDevice currentDevice] systemVersion] floatValue]

#define SINGLE_LINE_WIDTH  (1 / [UIScreen mainScreen].scale) //宽度

#define SINGLE_LINE_OFFSET  ((1 / [UIScreen mainScreen].scale) / 2) //偏移量

#define Weakself(weakSelf)  __weak __typeof(&*self)weakSelf = self;

/**

*  十六进制颜色值

*

*  @param RGBValue 0x开头的十六进制数值

*

*  @return 颜色值

*/

#define UIColorFromRGB(RGBValue) [UIColor colorWithRed:((float)((RGBValue & 0xFF0000) >> 16))/255.0 green:((float)((RGBValue & 0xFF00) >> 8))/255.0 blue:((float)(RGBValue & 0xFF))/255.0 alpha:1.0]

/**

*  RGB 颜色值宏定义

*

*  @param R    R

*  @param G    G

*  @param B    B

*  @param Alpha 透明度

*

*  @return 颜色值

*/

#define RGBColor(R,G,B,Alpha) [UIColor colorWithRed:(double)R/255.0 green:(double)G/255.0 blue:(double)B/255.0 alpha:Alpha]

上一篇下一篇

猜你喜欢

热点阅读