如果 UIView 在窗口边界之外,则来自 UIView 的 UIImage [英] UIImage from UIView if UIView is outside window bounds

查看:38
本文介绍了如果 UIView 在窗口边界之外,则来自 UIView 的 UIImage的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有 UIScrollView,其中添加了许多 UIView 视图.我想将 UIView 及其子视图转换为 UIImage,如果 UIView 当前在设备屏幕上可见,我知道该怎么做.如果 UIView 不在 UIScrollView 可见矩形中,是否可以将 UIView(UIScrollView 中的子视图)转换为 UIImage?

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?

推荐答案

您能否遍历所有子视图,对 UIScrollView 中的每个 UIView 进行截图?

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

以下课程可能有助于截取屏幕截图:http://ioscodesnippet.com/2011/08/25/rendering-any-uiviews-into-uiimage-in-one-line/

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.

谢谢,迈克尔

这篇关于如果 UIView 在窗口边界之外,则来自 UIView 的 UIImage的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆