我正在像这样将图像保存到 nsdocumentdirectory
NSArray *pathArr = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask,
YES);
NSString *path = [[pathArr objectAtIndex:0]
stringByAppendingPathComponent:@"img.data" ];
NSLog(@"path=%@",path);
NSData *retrievedData = [NSData dataWithContentsOfFile:path];
imgView.image=[UIImage imageWithData:retrievedData];
问题是只保存了一张图像。如果我尝试显示图像,则会显示最后保存的图像。如何解决这个问题?