ios Sprite Kit screengrab?

后端 未结 4 655
小蘑菇
小蘑菇 2020-12-04 22:28

I am trying to get a screen grab of a view that has a SKScene in it. The technique I am using is:

UIGraphicsBeginImageContextWithOptions(self.view.bounds.si         


        
4条回答
  •  感动是毒
    2020-12-04 22:49

    //1: get texture from "someNode"

    let texture = skView.textureFromNode(someNode)
    

    //2: get UIImage from the node texture

    let image = UIImage(cgImage: texture!.cgImage())
    

提交回复
热议问题