swift3.0 屏幕截图并且保存到本地相册

it2022-05-05  137

所要截取的对象

var bg_view: UIView!

截取并且保存的代码如下

UIGraphicsBeginImageContextWithOptions(bg_view.frame.size, false, UIScreen.main.scale) bg_view.layer.render(in: UIGraphicsGetCurrentContext()!) let image = UIGraphicsGetImageFromCurrentImageContext() UIGraphicsEndImageContext() UIImageWriteToSavedPhotosAlbum(image!,self,#selector(image(_:didFinishSavingWithError:contextInfo:)), nil)

结束!

转载于:https://www.cnblogs.com/kunH/p/6925176.html

相关资源:各显卡算力对照表!

最新回复(0)