所以我有一個觀點,我基本上使用類似於下面的函數編程快照:捕獲的UIImage然後在WatchKit WKInterfaceImage使用
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。
我需要知道的是:有沒有一種方法來捕獲UIView的UIImage,當從WatchKit擴展觸發而不打開實際的iPhone應用程序,那麼如何檢索該圖像並將其顯示爲WKInterfaceImage?
那麼,使用openParentApplication我將能夠加載視圖並執行快照功能?我想我很難理解我會怎麼做。 – YichenBman 2015-03-31 14:12:15