I guess you have a CGPathRef
that you where able to draw in the CGContext
.
From there you can create a layer, assign the image as a content and use a CAShapeLayer
a s a mask to crop it.
CGPathRef path;
CAShapeLayer *shapeLayer = [CAShapeLayer layer];
[shapeLayer setPath:path];
CALayer *imgLayer = [CALayer layer];
[imgLayer setContents:img];
[imgLayer setMask:shapeLayer];
[self.layer addSublayer:imgLayer];