//这个例子是直接截取的viewController
UIGraphicsBeginImageContextWithOptions(self.view.bounds.size, false, UIScreen.main.scale)
self.view.layer.render(in: UIGraphicsGetCurrentContext()!)
let image = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
网友评论