I am wondering how my iPhone app can take a screen shot of a specific UIView
as a UIImage
.
I tried this code but all I get is a blank image
The following snippet is used to take screenshot :
UIGraphicsBeginImageContext(self.muUIView.bounds.size);
[myUIView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *screenShot = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
Use renderInContext:
method instead of drawInContext:
method
renderInContext:
method renders the receiver and its sublayers into current context. This method
renders directly from the layer tree.