How to take a layer's snapshot with mask layer?
Posted
by
OpenThread
on Stack Overflow
See other posts from Stack Overflow
or by OpenThread
Published on 2012-06-18T03:10:29Z
Indexed on
2012/06/18
3:16 UTC
Read the original article
Hit count: 139
iphone
|quartz-graphics
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!
© Stack Overflow or respective owner