Lets say I have a UIColor
UIColor *color = [UIColor redColor];
Now I want to modify the saturation/hue/brigthness, how do I do that? I did read the documentation but i'm still really confused
I want to modify the UIColor I made ([UIColor redColor]) not initiate a new color with some preferences. How do I modify it retaining the original. I do know about thecolorWithHue:saturation:brightness:alpha:
method, I need to update an existing color's properties, keeping the red color.
You can call getHue:saturation:brightness:alpha:
on your color, then adjust the values, then create a new color with your adjusted components using +[UIColor colorWithHue:saturation:brightness:alpha:]
CGFloat hue, saturation, brightness, alpha ;
BOOL ok = [ <color> getHue:&hue saturation:&saturation brightness:&brightness alpha:&alpha ] ;
if ( !ok ) {
// handle error
}
// ... adjust components..
UIColor * newColor = [ UIColor colorWithHue:hue saturation:saturation brightness:brightness alpha:alpha ] ;