I have a UIBezierpath with a circle shape:
UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:rect cornerRadius:100];
But then I want to fill in the UIImage circle (show only part of the image inside the circle)
Best regards Kristian
Edit:
Thanks to Daniel and Dave for the excellent answers: D saved me a lot of trouble, D
Solutions:
CGContextRef ctx = UIGraphicsGetCurrentContext();
CGContextAddPath(ctx, path.CGPath);
CGContextClip(ctx);
and:
path.addClip;
Both work fine, but I ended up using the latter method (from Dave) because it needs less code.
source
share