iwill iwill - 2 months ago 20
Objective-C Question

How to get inverse color from UIColor?

e.g. The inverse color from black should be white.

Answer

iOS5+

-(UIColor*) inverseColor
{
    CGFloat r,g,b,a;
    [self getRed:&r green:&g blue:&b alpha:&a];
    return [UIColor colorWithRed:1.-r green:1.-g blue:1.-b alpha:a];
}
Comments