【发布时间】:2016-04-12 11:37:05
【问题描述】:
我在 iOS 应用程序中有一个视图,其中添加了多个 wkwebview 作为子视图来呈现 html 内容。它显示了所有内容,但是当我尝试截屏时,它显示为空白,好像内容从未在 wkwebviews 中呈现。
我用来截图的代码:
//view is parent view which contains wkwebviews as childviews
func takeScreenShot(view: UIView) -> UIImage{
UIGraphicsBeginImageContext(view.bounds.size)
view.layer.renderInContext(UIGraphicsGetCurrentContext()!)
let image = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return image
}
当我检查 UI Hierarchy 时,wkwebviews 的内容实际上超出了父视图的范围。有合适的截图方法吗?
【问题讨论】:
标签: ios swift uiview wkwebview