Skip to content

Instantly share code, notes, and snippets.

@tmack8001
Created May 4, 2015 21:51
Show Gist options
  • Save tmack8001/e55651c787662819bbf4 to your computer and use it in GitHub Desktop.
Save tmack8001/e55651c787662819bbf4 to your computer and use it in GitHub Desktop.
UIColor from RGBA (RGB+Alpha macro for iOS)
#define UIColorFromRGBA(rgbaValue) [UIColor \
colorWithRed : ((float)((rgbaValue & 0xFF000000) >> 24)) / 255.0 \
green : ((float)((rgbaValue & 0xFF0000) >> 16)) / 255.0 \
blue : ((float)(rgbaValue & 0xFF00) >> 8) / 255.0 \
alpha : ((float)(rgbaValue & 0xFF)) / 255.0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment