ios - CGColor not defined for the UIColor UIDeviceRGBColorSpace 1 1 0 1 -
application crash , have error in xcode console:
nsinvalidargumentexception', reason: '*** -cicolor not defined uicolor uidevicergbcolorspace 1 1 0 1; need first convert colorspace.
when try display value of rgb color :
var color:uicolor print("color \(color.cicolor.red) \(color.cicolor.green) \(color.cicolor.blue)")
from cicolor
doc:
var cicolor: cicolor { }
the core image color associated receiver. (read-only) property throws exception if color object not initialized core image color.
use getred
method rgb:
var color = uicolor.redcolor() var fred: cgfloat = 0 var fgreen: cgfloat = 0 var fblue: cgfloat = 0 var falpha: cgfloat = 0 if color.getred(&fred, green: &fgreen, blue: &fblue, alpha: &falpha) { print("color \(fred) \(fgreen) \(fblue)") } else { print("error: color not converted") }
Comments
Post a Comment