我尝试过:
但结果是一张空的截图。希望能得到帮助!
请注意,我想要对一个CAMetalLayer进行截图。
let scale = UIScreen.mainScreen().scale
UIGraphicsBeginImageContextWithOptions(metalLayer.bounds.size, false, scale)
// metalLayer.renderInContext(UIGraphicsGetCurrentContext()!)
// self.view.layer ...
metalLayer.presentationLayer()!.renderInContext(UIGraphicsGetCurrentContext()!)
let image = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil)
但结果是一张空的截图。希望能得到帮助!
请注意,我想要对一个CAMetalLayer进行截图。
}
。 - Klaas