Skip to content

October 16, 2008

Get a snapshot of the image in the current view

Are you trying to save an image of your active UIView into a file or
the photo library?

If so, here:

        UIGraphicsBeginImageContext(pictureView.bounds.size);
        [pictureView.layer renderInContext:UIGraphicsGetCurrentContext()];

        UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
        UIGraphicsEndImageContext();
        UIImageWriteToSavedPhotosAlbum(viewImage, nil, nil, nil);

pictureView is the UIView that you want to save.

Sze Wong
Zerion Consulting
http://www.zerionconsulting.com

On Sep 30, 12:13 am, equrick <li@nibirutech.com> wrote:

 

> hi,all. how can I get a snap image of the current top view on the
> screen?  Are there some Api?
> many thanks.
- Hide quoted text -
Read more from Software Development

Share your thoughts, post a comment.

(required)
(required)

Note: HTML is allowed. Your email address will never be published.

Subscribe to comments