Skip to content

Instantly share code, notes, and snippets.

@codeswimmer
Forked from BrettBukowski/gist:3375895
Created August 17, 2012 04:22
Show Gist options
  • Save codeswimmer/3375904 to your computer and use it in GitHub Desktop.
Save codeswimmer/3375904 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