Swift获取屏幕快照

 // 获取屏幕快照
private func screenShot() -> UIImage{
let window = UIApplication.shared.keyWindow!
UIGraphicsBeginImageContext(window.size) // 绘图
window.drawHierarchy(in: window.bounds, afterScreenUpdates: false) // 从图形上下文获取图片
let image = UIGraphicsGetImageFromCurrentImageContext()! UIGraphicsEndImageContext() return image
}
上一篇:获取select赋值


下一篇:maketrans translate