Search code examples
iphoneiosobjective-cquartz-graphics

Clipping multiple paths out of UIImage


In my drawRect method I draw a UIImage, eg

[[UIImage imageNamed:@"shape.png"] drawInRect:CGRectMake(50,50,50,50)];

I want to be able to clip multiple shapes out of the shape so the background of the view is shown. I can't seem to get the quartz clipping methods to behave as I want.

Can anyone help push me in the right direction?

Thanks!


Solution

  • I think what you are wanting is to create a mask and apply that to a UIImage. Take a look here: Rounded corners question.