UIImage from UIView if UIView is outside window bo

2019-09-17 17:24发布

问题:

I have UIScrollView with many UIView views added to the content. I would like to convert UIView and its subviews to UIImage and I know how to do it if the UIView is currently visible on the device screen. Is it possible to convert UIView (subview in UIScrollView) into UIImage if UIView is not in UIScrollView visible rect?

回答1:

Could you just iterate over all subviews taking a screenshot of each UIView inside the UIScrollView ?

The following class may help with taking screenshots: http://ioscodesnippet.com/2011/08/25/rendering-any-uiviews-into-uiimage-in-one-line/

Hope you find a solution.

Thanks, Michael