Skip to content

Instantly share code, notes, and snippets.

@akio46
Created December 1, 2016 17:49
Show Gist options
  • Save akio46/bee3fb6bc2141d8695a1a343a54d0051 to your computer and use it in GitHub Desktop.
Save akio46/bee3fb6bc2141d8695a1a343a54d0051 to your computer and use it in GitHub Desktop.
get screenshot image of specific view
- (UIImage *)getSnapshotFromView:(UIView *)v {
UIGraphicsBeginImageContextWithOptions(v.bounds.size, NO, 0.0f);
CGContextRef context = UIGraphicsGetCurrentContext();
[v.layer renderInContext:context];
UIImage *snapshotImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return snapshotImage;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment