相关疑难解决方法(0)

使用金属快速拍摄当前屏幕的快照

我试过了:

 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)
Run Code Online (Sandbox Code Playgroud)

但结果是一个空截图.你能帮忙的话,我会很高兴!

请记住,我想拍摄CAMetalLayer的快照

swift metal

4
推荐指数
3
解决办法
4309
查看次数

标签 统计

metal ×1

swift ×1