Skip to content

Instantly share code, notes, and snippets.

View bagpack's full-sized avatar

bagpack bagpack

View GitHub Profile
@bagpack
bagpack / UIImage+Snapshot.m
Last active September 9, 2015 01:21 — forked from anthonycastelli/UIImage+Snapshot.m
Snapshotting on iOS
+ (UIImage *)snapshotView:(UIView *)view {
UIGraphicsBeginImageContextWithOptions(view.frame.size, NO, [[UIScreen mainScreen] scale]); //0
[view drawViewHierarchyInRect:view.frame afterScreenUpdates:YES];
UIImage *snapshot = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return snapshot;
}
+ (UIImage *)snapshot {
CGSize imageSize = CGSizeZero;