How can I fill a rect with an alpha color using CoreGraphics?

Posted by Rits Plasman on Stack Overflow See other posts from Stack Overflow or by Rits Plasman
Published on 2010-05-29T15:23:52Z Indexed on 2010/05/29 15:32 UTC
Read the original article Hit count: 418

In my drawRect method, I am drawing a PNG image. On top of that, I want to draw a rect with a 20% alpha color, like this:

[[UIColor colorWithWhite:0.0 alpha:0.2] set];
UIRectFill(rect);

The problem is, that the alpha property seems to get ignored. No alpha is applied at all, just a black rectangle is drawn. How can I fix this? Thanks in advance!

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c