There’s this method in UIColor in iOS 5:
- (BOOL)getHue:(CGFloat *)hue saturation:(CGFloat *)saturation brightness:(CGFloat *)brightness alpha:(CGFloat *)alpha
But i don’t understand how i’m meant to use that in code. Surely i don’t need to be stating each of those components if i’m looking to get that out of the UIColor?
getHue:saturation:brightness:alpha:returns a bool, determining, if the UIColor could had been converted at all.Example:
will log
0.619403 0.744444 0.900000 1.000000 1, as it is validwhile
logs
0.000000 0.000000 -1.998918 0.000000 0. The last 0 is the Bool, so this is not valid, and actuallybrightness can only range from 0.0 to 1.0, but here it holds some random crap.Conclusion
The code should be something like