2016年8月10日 星期三

iOS save picture to App document folder

/* create path to cache directory inside the application's Documents directory */
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *filePath = [[paths objectAtIndex: 0] stringByAppendingPathComponent: @"output.jpg"];
NSData *photoData = UIImageJPEGRepresentation(dstImg, 1);
[photoData writeToFile:filePath atomically: YES];

沒有留言:

張貼留言