【发布时间】:2015-03-31 05:37:08
【问题描述】:
所以我有一个观点,我使用一个基本类似于此的函数以编程方式进行快照:
func captureImage() -> UIImage{
UIGraphicsBeginImageContextWithOptions(bounds.size, false, 0.0)
drawViewHierarchyInRect(self.bounds, afterScreenUpdates: true)
// old style: layer.renderInContext(UIGraphicsGetCurrentContext())
let image = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return image
}
该函数按预期工作,并返回一个 UIImage。
我需要知道的:有没有办法在不打开实际 iPhone 应用程序的情况下从 WatchKit 扩展触发时捕获 UIView 的 UIImage,然后如何检索该图像并将其显示为 WKInterfaceImage?
【问题讨论】: