Regarding saving the UIColor in a Plist: I have tried different ways but not been able to do so, I want to save and retrieve the color values in a plist file.
I can not extract the data value of the color using nslog and save it in the plist.
Is there any other way to do so?
I prefer using string to store the color. The parsing code that does this shown below (cut out from https://github.com/xslim/TKThemeManager/blob/master/TKThemeManager.m#L162)
+ (UIColor *)colorFromString:(NSString *)hexString {
NSScanner *scanner = [NSScanner scannerWithString:hexString];
unsigned hex;
BOOL success = [scanner scanHexInt:&hex];
if (!success) return nil;
if ([hexString length] <= 6) {
return UIColorFromRGB(hex);
} else {
unsigned color = (hex & 0xFFFFFF00) >> 8;
CGFloat alpha = 1.0 * (hex & 0xFF) / 255.0;
return UIColorFromRGBA(color, alpha);
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With