2012-04-10 50 views
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]; 
} 

謝謝。

回答