tags:

views:

379

answers:

2

Is there any way to set any color of UIImage (or it CALayer content) as transparent color?

I cannot use single image resource(PNG file) with built-in transparency.

I need to hide some area from first Layer by overlaying second Layer with specific color at that place. So I need to set this specific color as "transparent color" before assembled image drawing.

Image area I need to hide is like background - i.e. specific color will be started from image borders through whole perimeter.

EDIT: just found similar question here

+1  A: 

Sounds like you need to use CGImageCreateWithMaskingColors. I recommend reading the "Bitmap Images and Image Masks" part of the Quartz Programming Guide, and check some example code. It's slightly more low-level than your average Cocoa code, but not very hard to accomplish.

Felixyz
Thank you for your answer! I've tried it before for other purpose... Looks like it's only way to meet my current needed.
MikZ
A: 

I just updated a similar question with some more details here

aloo