如何通过代码(在Swift中)从我的屏幕截取屏幕截图并保存?我可以截取屏幕并将其保存为图像吗?
我看了,我看到了这段代码,但我不能使用它(我认为),因为它没有做任何事情.
var screen = UIScreen.mainScreen()
snapshotVieww = screen.snapshotViewAfterScreenUpdates(false)
UIGraphicsBeginImageContextWithOptions(screen.bounds.size, false, 0)
snapshotVieww.drawViewHierarchyInRect(view.bounds, afterScreenUpdates: true)
var image:UIImage = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
provino = UIImageView(image: image)
Run Code Online (Sandbox Code Playgroud)