[Swift5] スクリーンショットを保存
スクリーンショットを保存
シェアボタンが押された時などに呼ばれるメソッドを作成
var screenShotImage = UIImage()
func takeScreenShot(){
let width = CGFloat(UIScreen.main.bounds.size.width)
let height = CGFloat(UIScreen.main.bounds.size.height)
let size = CGSize(width: width, height: height)
UIGraphicsBeginImageContextWithOptions(size, false, 0.0)
//viewに書き出す
self.view.drawHierarchy(in: view.bounds, afterScreenUpdates: true)
screenShotImage = UIGraphicsGetImageFromCurrentImageContext()!
UIGraphicsEndImageContext()
}
Author And Source
この問題について([Swift5] スクリーンショットを保存), 我々は、より多くの情報をここで見つけました https://qiita.com/_suidobashi/items/5a9e6327c2813a5345f2著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .