Skip to content

Instantly share code, notes, and snippets.

@dstnbrkr
Created March 28, 2011 19:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dstnbrkr/891109 to your computer and use it in GitHub Desktop.
Save dstnbrkr/891109 to your computer and use it in GitHub Desktop.
Convert hex value to UIColor
UIColor* UIColorFromRGB(NSInteger rgb) {
return [UIColor colorWithRed:((float) ((rgb & 0xFF0000) >> 16)) / 0xFF
green:((float) ((rgb & 0xFF00) >> 8)) / 0xFF
blue:((float) (rgb & 0xFF)) / 0xFF
alpha:1.0];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment