iOS 宏定义~RGB(颜色)

//联系人:石虎QQ: 1224614774昵称:嗡嘛呢叭咪哄

一、颜色宏定义

// RGB颜色转换(16进制->10进制)

// RGB颜色转换(16进制->10进制)

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

//带有RGBA的颜色设置

//带有RGBA的颜色设置

#define UICOLOR_RGB(R, G, B, A) [UIColor colorWithRed:R/255.0green:G/255.0blue:B/255.0alpha:A]

//随机颜色

//随机颜色

#define UICOLOR_RANDOM  [UIColor colorWithRed:(arc4random()%255)/255.0green:(arc4random()%255)/255.0blue:(arc4random()%255)/255.0alpha:1.0]

谢谢!!!

你可能感兴趣的:(iOS 宏定义~RGB(颜色))