- Home /
How to make screenshot on iPhone?
I need to post screenshots from my iphone app to facebook. I tried to use ReadPixels, but it does not work on my iPhone (but worked well in editor/browser). I don't want to use Application.CaptureScreenShot because it save image to the flash and i don't need it. How can I make screenshot? Maybe some native code approach?
Answer by tzr15 · Aug 17, 2011 at 06:23 PM
In native code, you can use UIGraphicsGetImageFromCurrentImageContext...
UIGraphicsBeginImageContext(Background.bounds.size); [Background.window.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext();
//save to photo album, or use FileManager to save somewhere else UIImageWriteToSavedPhotosAlbum(viewImage, nil, nil, nil);
make sure you import the quartzcore framework.. and include it in your header
include
Your answer
![](https://koobas.hobune.stream/wayback/20220612182547im_/https://answers.unity.com/themes/thub/images/avi.jpg)