How can I make a screenshot programmatically in iOS?
Asked
Active
Viewed 244 times
0
-
possible duplicate of [Take screenshot from code](http://stackoverflow.com/questions/3945800/take-screenshot-from-code) – Brad Larson Dec 31 '10 at 16:26
-
Possible duplicate of [How can I take screenshot from code on iOS?](https://stackoverflow.com/questions/3945800/how-can-i-take-screenshot-from-code-on-ios) – Cœur Apr 29 '19 at 14:48
1 Answers
3
have fun
UIGraphicsBeginImageContext(self.view.bounds.size);
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *myScreenshot = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

Alex Wayne
- 178,991
- 47
- 309
- 337