tags:

views:

1245

answers:

1

Hi

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

Thanks.

+22  A: 

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);
lostInTransit
Add #import <QuartzCore/QuartzCore.h> to use this code.
Tyler