UIScreen *screen = [UIScreen mainScreen] ;
UIWindow *keyWindow = [[UIApplication sharedApplication] keyWindow];
UIView *view = [screen snapshotViewAfterScreenUpdates:YES];
UIGraphicsBeginImageContextWithOptions(screen.bounds.size, NO, 0);
[keyWindow drawViewHierarchyInRect:keyWindow.bounds afterScreenUpdates:YES];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
NSData *data= UIImagePNGRepresentation(image);
[data writeToFile:[NSString stringWithFormat:@"%@/ScreenShot.png",[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]] atomically:YES];
Friday, 3 January 2014
Taking screenshot programmatically in iOS 7
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment