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
iOS7 onwards, we have below default methods :
- (UIView *)snapshotViewAfterScreenUpdates:(BOOL)afterUpdates
Calling above method is faster than trying to render the contents of the current view into a bitmap image yourself.
If you want to apply a graphical effect, such as blur, to a snapshot, use the drawViewHierarchyInRect:afterScreenUpdates:
method instead.
https://developer.apple.com/library/ios/documentation/uikit/reference/uiview_class/uiview/uiview.html