I am Adding multiple CAShapeLayer
s to layer
property of my UIView
subclass by calling [self.layer addSublayer:shapeLayer];
To capture these layers in a UIImage
I have implemented the following method which is meant to take an image of the layer
property.
- (UIImage *)takeImage {
UIGraphicsBeginImageContext(self.frame.size);
CGContextRef context = UIGraphicsGetCurrentContext();
if (context) {
[self.layer renderInContext:context];
UIImage *snapshotImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return snapshotImage;
}
return nil;
}
My Problem is, that the resulting image is completely blank. Why is this so?