For the visuals in my iPhone application I'm compositing UIImages in a transparent UIView. I'd like the images to appear in their normal colors sometimes, but under other conditions I want them to be drawn tinted red. This is easy to do with opaque square images, but parts of my images are translucent, and I only want to tint the solid parts, leaving the transparent parts transparent.
I tried drawing a red rectangle on top of my graphics using different blend modes in a transparency layer (CGContextBeginTransparencyLayerWithRect), but it always results in the entire red rectangle appearing over the background. I would expect blending to respect transparency, but for some reason it doesn't.
My final solution was to make two different versions of my graphic, but is there some way I could have drawn the images with a tint after all?