I want to use NSAttributedString
in my project, but when I\'m trying to set color, which isn\'t from the standard set (redColor
, blackColor>
One of my favourite macros, no project without:
#define RGB(r, g, b) [UIColor colorWithRed:(float)r / 255.0 green:(float)g / 255.0 blue:(float)b / 255.0 alpha:1.0]
#define RGBA(r, g, b, a) [UIColor colorWithRed:(float)r / 255.0 green:(float)g / 255.0 blue:(float)b / 255.0 alpha:a]
Using like:
[attributedString addAttribute:NSForegroundColorAttributeName
value:RGB(66, 79, 91)
range:NSMakeRange(0, attributedString.length)];