|
@@ -230,5 +230,26 @@ public extension UIImage {
|
|
UIGraphicsEndImageContext()
|
|
UIGraphicsEndImageContext()
|
|
return tintedImage
|
|
return tintedImage
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ class func saveImage(currentImage: UIImage,outFilePath: String) {
|
|
|
|
+
|
|
|
|
+ if FileManager.default.fileExists(atPath: outFilePath) {
|
|
|
|
+ do {
|
|
|
|
+ try FileManager.default.removeItem(at: NSURL.fileURL(withPath: outFilePath))
|
|
|
|
+ } catch {
|
|
|
|
+ BFLog(message: "删除文件出错 == \(error) \(outFilePath)")
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if let imageData = currentImage.pngData() {
|
|
|
|
+ try? imageData.write(to: URL(fileURLWithPath: outFilePath))
|
|
|
|
+ print("保存图片成功到:filePath=\(outFilePath)")
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|