2
當我將圖像保存到文件時,它以錯誤的方向保存。當我將圖像保存到文件時,保存的方向是錯誤的
- (void)saveImage:(UIImage *)image:(NSString *)imageName
{
NSData *imageData = UIImagePNGRepresentation(image);
NSFileManager *fileManager = [NSFileManager defaultManager];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *fullPath = [documentsDirectory stringByAppendingPathComponent:
[NSString stringWithFormat:@"%@.png", imageName]];
[fileManager createFileAtPath:fullPath contents:imageData attributes:nil];
}
謝謝。
爲我工作,謝謝。 – kelin 2015-07-30 16:31:22