Tuesday, 22 March 2011

UIColor from RGB iPhone

I’ve write the simple code.

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

Use it like that
self.navigationController.navigationBar.tintColor = UIColorFromRGB(0xa90606);

Note:- write 0x before your RGB code.

No comments:

Post a Comment