创建文件夹
try! FileManager.default.createDirectory(at: URL.init(fileURLWithPath: myDirectory1), withIntermediateDirectories: true, attributes: nil)
将图片转化为DATA保存到沙盒
‘let image = UIImage.init(named: "launch") if let imageData = image!.jpegData(compressionQuality: 1.0) as NSData? { let fullPath = myDirectory1.appending("sss.jpg") imageData.write(toFile: fullPath, atomically: true) print("fullPath=\(fullPath)") }’
网友评论