标签:error etc 屏幕截图 pre inf swift 截图 uiimage ons
所要截取的对象
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)
结束!
标签:error etc 屏幕截图 pre inf swift 截图 uiimage ons
原文地址:http://www.cnblogs.com/kunH/p/6925176.html