Skip to content

Instantly share code, notes, and snippets.

@skwashua
Created December 10, 2013 16:38
Show Gist options
  • Save skwashua/7893674 to your computer and use it in GitHub Desktop.
Save skwashua/7893674 to your computer and use it in GitHub Desktop.
iOS 7 Screenshot
CGSize imageSize = [[UIApplication sharedApplication] keyWindow].bounds.size;
UIGraphicsBeginImageContextWithOptions(imageSize, NO, [[UIScreen mainScreen] scale]);
[[[UIApplication sharedApplication] keyWindow] drawViewHierarchyInRect:[[UIApplication sharedApplication] keyWindow].bounds afterScreenUpdates:YES];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return viewImage;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment