get a snap image of the current top view on the screen

18 views
Skip to first unread message

equrick

unread,
Sep 30, 2008, 12:13:51 AM9/30/08
to iPhone SDK Development
hi,all. how can I get a snap image of the current top view on the
screen? Are there some Api?

many thanks.

Sze

unread,
Oct 3, 2008, 12:31:59 PM10/3/08
to iPhone SDK Development
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

Li Wei

unread,
Oct 5, 2008, 9:54:26 PM10/5/08
to iphonesdkd...@googlegroups.com
thank you.I 'll try that.

Li Wei

unread,
Oct 5, 2008, 10:35:48 PM10/5/08
to iphonesdkd...@googlegroups.com
thank you Sze.
Reply all
Reply to author
Forward
0 new messages