Posted By

tenveer on 10/18/10


Tagged

write screenshot UIImage


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

bobbym245

cnathan


take a screen shot of the view and save it in photo library


 / Published in: Objective C
 

take a screen shot of the view passed in "UIGraphicsBeginImageContext"

  1. UIGraphicsBeginImageContext(self.window.bounds.size);
  2. [self.window.layer renderInContext:UIGraphicsGetCurrentContext()];
  3. UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
  4. UIGraphicsEndImageContext();
  5. NSData * data = UIImagePNGRepresentation(image);
  6. [data writeToFile:@"board.png" atomically:YES];

Report this snippet  

You need to login to post a comment.