Created
December 19, 2013 20:28
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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