0
林救了我的NSDocumentsDirectory圖像與此:加載多個圖像
for (int i = 0; i < info.count; i++) {
NSLog(@"%@", [info objectAtIndex:i]);
NSString *savedImagePath = [documentsDir stringByAppendingPathComponent:[NSString stringWithFormat:@"oneSlotImages%d.png", i]];
ALAssetRepresentation *rep = [[info objectAtIndex: i] defaultRepresentation];
UIImage *image = [UIImage imageWithCGImage:[rep fullResolutionImage]];
NSData *imageData = UIImagePNGRepresentation(image);
[imageData writeToFile:savedImagePath atomically:YES];
}
有困難的進出口它們加載到一個數組。我在網上搜索過這個。 可以這樣使用NSDocumentsDirectory
?
for(int i = 1; i <= 21; i++)
{
[images addObject:[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"Images%d.png", i] ofType:@"jpg"]]];
}