Programmatically take a screenshot of specific area

后端 未结 4 1561
半阙折子戏
半阙折子戏 2020-12-24 15:06

Like you can see in my code, I take a screenshot and save it to the photo album.

//for retina displays
if ([[UIScreen mainScreen] respondsToSelector:@selecto         


        
4条回答
  •  无人及你
    2020-12-24 15:11

    I solved my problem but didn't answer the question:

    I created a subclass of UIView and moved my UIWebView in there, so that it is located 0/0 relative to the subclass. Then use the size of the WebView:

    UIGraphicsBeginImageContext(webview.frame.size);
    

    and the other code from above.

    Now you can move the subclass to every location you want.

    Note: If you have labels like date/time label you have to move them too or you won't see them on the picture.

    So create a subclass of UIView and move every IBOutlet you want to be seen on the picture in there.

    The question is still open: So is it possible to take a picture of a specific area of the screen?

    Kind Regards. $h@rky

提交回复
热议问题