views:

34

answers:

2

I am currently doing this:

UIColor *myColor = [UIColor clearColor]; 

This is great but i would like to specify a certain alpha of "myColor". How would i do so?

+1  A: 

[UIColor clearColor] is, how should I put it?, clear!

It is a convenience class method returning a UIColor with alpha at zero.

If you want a color with a fractional amount of transparency:

+ (UIColor *)colorWithRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha

Or one of the other UIColor class methods.

ohhorob
+2  A: 

You can use colorWithWhite:alpha like so:

[UIColor colorWithWhite:1.0 alpha:0.5];

Or if you want a specific color:

[UIColor colorWithRed:1.0 green:1.0 blue:0.3 alpha:0.72];

Check out the docs.

Whisty