Swift中UIImageWriteToSavedPhotosAlbum的使用

  • 方法调用 此处的save和方法实现中要保持一致
UIImageWriteToSavedPhotosAlbum(img, self, #selector(save(image:didFinishSavingWithError:contextInfo:)), nil)
  • 方法实现
   func save(image:UIImage, didFinishSavingWithError:NSError?,contextInfo:AnyObject) {
        
        if didFinishSavingWithError != nil {
            SVProgressHUD.showError(withStatus: "保存失败")
            SVProgressHUD.setDefaultMaskType(SVProgressHUDMaskType.black)
        } else {
            SVProgressHUD.showSuccess(withStatus: "保存成功")
            SVProgressHUD.setDefaultMaskType(SVProgressHUDMaskType.black)
        }
    }

你可能感兴趣的:(Swift中UIImageWriteToSavedPhotosAlbum的使用)