Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone - saving current view as image

Tags:

How can I save the current view as an image to Camera roll from my application? Is it possible?

Thanks.

like image 201
lostInTransit Avatar asked Apr 14 '09 05:04

lostInTransit


People also ask

How do I save my current wallpaper on my iPhone?

Download Wallpaper To grab the images at iFixit and other sites from your iPhone, tap the image, tap the iOS Share icon, and select the option to Save Image. Open your Photos app and swipe to the image you just saved.


1 Answers

Found the solution. Might help someone. To save the current view as an image, do the following

UIGraphicsBeginImageContext(pictureView.bounds.size); 
                  [pictureView.layer renderInContext:UIGraphicsGetCurrentContext()];   UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();  UIGraphicsEndImageContext();  UIImageWriteToSavedPhotosAlbum(viewImage, nil, nil, nil);  
like image 89
lostInTransit Avatar answered Sep 18 '22 13:09

lostInTransit