我正在尝试拍摄视图的快照,并将其绘制在我UIScrollView
的顶部。这是我的代码:
*在viewWillAppear
方法
let view = mItemViews[1].getMetaDataContainer()
UIGraphicsBeginImageContextWithOptions(view.bounds.size, true, 0)
view.drawHierarchy(in: view.bounds, afterScreenUpdates: true)
let image = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
image?.draw(at: mScrollView.frame.origin)
但是,图像永远不会被绘制到scrollview的顶部。如何将此视图的快照绘制到滚动视图的顶部?