For a quick fix (but maybe not the prettiest one):
- Add color property as type Number to plist
- Enter the color as RGB hexadecimal, for example:
0xff00e3
- Read this and process it with a macro as shown below.
Here is a sample code:
// Add this code to some include, for reuse #define UIColorFromRGBA(rgbValue, alphaValue) ([UIColor colorWithRed:((CGFloat)((rgbValue & 0xFF0000) >> 16)) / 255.0 \ green:((CGFloat)((rgbValue & 0xFF00) >> 8)) / 255.0 \ blue:((CGFloat)(rgbValue & 0xFF)) / 255.0 \ alpha:alphaValue]) // This goes into your controller / view NSDictionary *myPropertiesDict = [NSDictionary dictionaryWithContentsOfFile:...]; UIColor *titleColor = UIColorFromRGBA([myPropertiesDict[@"titleColor"] integerValue], 1.0);
After entering the color as hexadecimal, the plist editor will show it as a decimal number. Not good. As a developer, as a rule, you copy all the colors from a project document, so the need to read the color values ββis not so great.
Berik
source share