Skip to content

Instantly share code, notes, and snippets.

@oliverbarreto
Created December 19, 2013 20:28
Show Gist options
  • Select an option

  • Save oliverbarreto/8045719 to your computer and use it in GitHub Desktop.

Select an option

Save oliverbarreto/8045719 to your computer and use it in GitHub Desktop.
UIColorFromRGB(rgbValue) Normally you want to use your own color as the system color doesn’t look nice. Here is a very useful macro for setting RGB color.
// Define somewhere in a header or macro file included on prefix.psc file or put it somewhere at the beginning of AppDelegate.m and use it to create any UIColor object with whatever RGB color you want. Below is an example:
// Get colors at http://colorschemedesigner.com
#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]
// Usage !!!
[[UINavigationBar appearance] setBarTintColor:UIColorFromRGB(0x067AB5)];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment