-- iOS (iPhone)

UIColor를 RGB로 입력하기

어린왕자악꿍 2012. 12. 6. 14:45

#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]


#define UIColorFromRGBWithAlpha(rgbValue,a) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \

green:((float)((rgbValue & 0xFF00) >> 8))/255.0 \

blue:((float)(rgbValue & 0xFF))/255.0 alpha:a]



labelName.textColor = UIColorFromRGB(0xf4f4f4);

labelName.backgroundColor = UIColorFromRGBWithAlpha(0xf4f4f4, 1.0);