How can I take a screenshot from the code on iOS?

How can I take a screenshot from the code?

+3
source share
2 answers

http://www.iphonedevsdk.com/forum/iphone-sdk-development/2353-possible-make-screenshot-programmatically-2.html

#include <QuartzCore/QuartzCore.h>

UIGraphicsBeginImageContext(Background.bounds.size);
[Background.window.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

UIImageWriteToSavedPhotosAlbum(viewImage, nil, nil, nil);
+5
source

For the opengl es scene, this is more active: http://www.bit-101.com/blog/?p=1861

+1
source

Source: https://habr.com/ru/post/1769805/


All Articles