funcScreenshot() {//截取指定UIView
UIGraphicsBeginImageContextWithOptions(self.view.frame.size,false,UIScreen.main.scale)
self.view.layer.render(in:UIGraphicsGetCurrentContext()!)
letimage =UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
UIImageWriteToSavedPhotosAlbum(image!,self,nil,nil)
}
网友评论