How can I obtain a CGColor from RGB values?
On Mac OS X there is CGColorCreateGenericRGB()
, but it doesn't exist on iOS. You can use CGColorCreate
with appropriate parameters, though.
self.layer.borderColor = CGColorCreate(CGColorSpaceCreateDeviceRGB(), [1.0, 0.5, 0.5, 1.0])
The values in the array are, in order of appearance: red, green, blue, and alpha. Just like UIColor
:)