Skip to content

Instantly share code, notes, and snippets.

@yoheiMune
Created February 20, 2019 06:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yoheiMune/3c2375d0b98f7377d0984ec2c2ef2fa5 to your computer and use it in GitHub Desktop.
Save yoheiMune/3c2375d0b98f7377d0984ec2c2ef2fa5 to your computer and use it in GitHub Desktop.
class FilterViewController : UIViewController {
override func viewDidLoad() {
// ナビゲーション右に保存ボタンを追加します.
let rightButton = UIBarButtonItem(title: "保存する", style: .plain, target: self, action: #selector(FilterViewController.saveImage))
self.navigationItem.rightBarButtonItem = rightButton
}
// 画像を保存する.
@objc func saveImage() {
// フィルター加工した画像を取得します.
guard let filteredImage = self.filteredImageView.image else {
return
}
// 写真アプリに保存します.
UIImageWriteToSavedPhotosAlbum(filteredImage, nil, nil, nil)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment