Transform hex color to objective-c color.


/ Published in: Objective C
Save to your folder(s)

This is exactly what I was looking for since I come from web development


Copy this code and paste it in your HTML
  1. //If you come from a web development background, you're probably more used to hex color //strings. Put this macro at the top of your .m file, after the imports
  2.  
  3. #define UIColorFromRGB(rgbValue) [UIColor \
  4. colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \
  5. green:((float)((rgbValue & 0xFF00) >> 8))/255.0 \
  6. blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
  7.  
  8. //Now you can simply write
  9. cell.textColor = UIColorFromRGB(0xFF3366);

URL: http://www.reigndesign.com/blog/liven-up-your-boring-uitableview-part-1/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.