1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| let filePath = mydir4 + "/appInfo.txt" let info = "this is test text" do{ try info.writeToFile(filePath, atomically: true, encoding: NSUTF8StringEncoding) }catch{ }
let image = UIImage(named: "2.jpg") let data : NSData = UIImageJPEGRepresentation(image!, 1.0)! let data1 : NSData = UIImagePNGRepresentation(image!)! data.writeToFile(mydir1 + "/2.jpg", atomically: true) data1.writeToFile(mydir1 + "/2.png", atomically: true)
let array = NSArray(objects: "111","222","333") array.writeToFile(mydir4 + "/array.plist", atomically: true)
let dic = NSDictionary(objects: ["1111","2222","3333"], forKeys: ["1","2","3"]) dic.writeToFile(mydir4 + "/dictionary.plist", atomically: true)
|