I added a mask to UIView’s layer:
CGImageRef maskImageRef = [UIImage imageNamed:"Icon.png"].CGImage;
CALayer maskLayer = [CALayer layer];
maskLayer.contents = (__bridge id)maskImageRef;
self.layer.mask = maskLayer;
Then I use this code to get snapshot from a UIView:
[self.layer renderInContext:mainViewContentContext];
But the mask wasn’t drawn.
How to draw self.layer with mask?
Special thx!
One way to fix this can be to use Quartz functions
Use CGContextClipToMask(context, rect, maskImage) inside drawRect method
Refer CGContextClipToMask example link for help