Skip to content

Instantly share code, notes, and snippets.

@marcuswestin
Created November 20, 2013 22:30
Show Gist options
  • Save marcuswestin/7572307 to your computer and use it in GitHub Desktop.
Save marcuswestin/7572307 to your computer and use it in GitHub Desktop.
Get color of iOS device
UIDevice *device = [UIDevice currentDevice];
SEL selector = NSSelectorFromString(@"deviceInfoForKey:");
if (![device respondsToSelector:selector]) {
selector = NSSelectorFromString(@"_deviceInfoForKey:");
}
if ([device respondsToSelector:selector]) {
NSLog(@"DeviceColor: %@ DeviceEnclosureColor: %@", [device performSelector:selector withObject:@"DeviceColor"], [device performSelector:selector withObject:@"DeviceEnclosureColor"]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment