所要截屏的view為
bg_view: UIView!
以截取該bg_view所在的區(qū)域?yàn)槔厝”4娲a如下
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)
利用swift內(nèi)置庫(kù)生成的二維碼無法直接保存到本地,我是直接截屏保存的搞坝,有其他解決辦法望告知