@objc private func saveBtnClick() {
// 1.获取当前正在显示的image
let cell = collectionView.visibleCells().first as! PhotoBrowserViewCell
guard let image = cell.imageView.image else {
return
}
// 2.将image对象保存相册
UIImageWriteToSavedPhotosAlbum(image, self, "image:didFinishSavingWithError:contextInfo:", nil)
}
@objc private func image(image : UIImage, didFinishSavingWithError error : NSError?, contextInfo : AnyObject) {
var showInfo = ""
if error != nil {
showInfo = "保存失败"
} else {
showInfo = "保存成功"
}
}