|
|
|
@@ -47,21 +47,11 @@ final class PhotoPreviewViewController: UIViewController {
|
|
47
|
47
|
navigationController?.setNavigationBarHidden(false, animated: true)
|
|
48
|
48
|
}
|
|
49
|
49
|
|
|
50
|
|
- @IBAction func download(_ sender: UIButton) {
|
|
51
|
|
- guard let cell = collectionView.cellForItem(at: IndexPath(item: viewModel.currIndex, section: 0)) as? ImageCell,
|
|
52
|
|
- let image = cell.photoImage.image else {
|
|
53
|
|
- // FFToastView.showToast(inView: view, withText: "未检测到图片")
|
|
54
|
|
- return
|
|
55
|
|
- }
|
|
56
|
|
-
|
|
57
|
|
- UIImageWriteToSavedPhotosAlbum(image, self, #selector(image(_:didFinishSavingWithError:contextInfo:)), nil)
|
|
58
|
|
- }
|
|
59
|
|
-
|
|
60
|
50
|
@objc func image(_ image: UIImage?, didFinishSavingWithError error: NSError?, contextInfo info: UnsafeMutableRawPointer) {
|
|
61
|
51
|
if error != nil {
|
|
62
|
|
- // FFToastView.showToast(inView: view, withText: "保存图片失败")
|
|
|
52
|
+ Toast.show(message: "保存照片失败")
|
|
63
|
53
|
} else {
|
|
64
|
|
- // FFToastView.showImageToast(inView: view, withText: "已保存图片到相册", withImage: "提示弹窗-勾")
|
|
|
54
|
+ Toast.show(message: "已保存照片到相册中", image: UIImage(named: "icon-success"))
|
|
65
|
55
|
}
|
|
66
|
56
|
}
|
|
67
|
57
|
}
|
|
|
|
@@ -105,6 +95,7 @@ extension PhotoPreviewViewController {
|
|
105
|
95
|
@IBAction func back() {
|
|
106
|
96
|
navigationController?.popViewController(animated: true)
|
|
107
|
97
|
}
|
|
|
98
|
+
|
|
108
|
99
|
@IBAction func rotateTheImage(_ sender: UIButton) {
|
|
109
|
100
|
guard let cell = collectionView.cellForItem(at: IndexPath(item: viewModel.currIndex, section: 0)) as? ImageCell else {
|
|
110
|
101
|
return
|
|
|
|
@@ -127,7 +118,16 @@ extension PhotoPreviewViewController {
|
|
127
|
118
|
}
|
|
128
|
119
|
}
|
|
129
|
120
|
|
|
130
|
|
-
|
|
|
121
|
+ @IBAction func download(_ sender: UIButton) {
|
|
|
122
|
+ Toast.showActivity(message: "正在保存照片到相册")
|
|
|
123
|
+ guard let cell = collectionView.cellForItem(at: IndexPath(item: viewModel.currIndex, section: 0)) as? ImageCell,
|
|
|
124
|
+ let image = cell.photoImage.image else {
|
|
|
125
|
+ Toast.show(message: "未检测到照片")
|
|
|
126
|
+ return
|
|
|
127
|
+ }
|
|
|
128
|
+
|
|
|
129
|
+ UIImageWriteToSavedPhotosAlbum(image, self, #selector(image(_:didFinishSavingWithError:contextInfo:)), nil)
|
|
|
130
|
+ }
|
|
131
|
131
|
}
|
|
132
|
132
|
|
|
133
|
133
|
// MARK: UICollectionView delegate
|