Skip to content

Instantly share code, notes, and snippets.

@BrettBukowski
Created August 17, 2012 04:18
Show Gist options
  • Save BrettBukowski/3375895 to your computer and use it in GitHub Desktop.
Save BrettBukowski/3375895 to your computer and use it in GitHub Desktop.
Display hex code for a UIColor
CGFloat red = 0.0, green = 0.0, blue = 0.0, alpha = 0.0;
[someColor getRed:&red green:&green blue:&blue alpha:&alpha];
[someLabel setText:[NSString stringWithFormat:@"#%02X%02X%02X", (int) red * 255.0f, (int) green * 255.0f, (int) blue * 255.0f]];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment