はい。以下のように渡す必要があります:`
- (void)setImage:(UIImage *)image forIndex:(int)index named:(NSString*)imageName{
// Create a reflection for this image.
UIImage *imageWithReflection = [image addImageReflection:kReflectionFraction];
NSNumber *coverNumber = [NSNumber numberWithInt:index];
[coverImages setObject:imageWithReflection forKey:coverNumber];
[coverImageHeights setObject:[NSNumber numberWithFloat:image.size.height] forKey:coverNumber];
[coverImageName setObject:imageName forKey:coverNumber];`
// If this cover is onscreen, set its image and call layoutCover.
AFItemView *aCover = (AFItemView *)[onscreenCovers objectForKey:[NSNumber numberWithInt:index]];
if (aCover) {
[aCover setImage:imageWithReflection originalImageHeight:image.size.height reflectionFraction:kReflectionFraction named:imageName];
[self layoutCover:aCover selectedCover:selectedCoverView.number animated:NO];
}
}`
そして、私は以下のように画像名を渡します:
for (int i=0; i < 10; i++) {
imageName = [[NSString alloc] initWithFormat:@"cover_%d.jpg", i];UIImage* image_=[UIImage imageNamed:imageName];
CGFloat width = 290;
CGFloat height = 200;
CGSize newSize=CGSizeMake(width, height);
[(AFOpenFlowView *)self.view setImage:[self imageWithImage:image_ scaledToSize:newSize] forIndex:i named:imageName];
[imageName release];
NSLog(@"%d is the index",i);
}
[(AFOpenFlowView *)self.view setNumberOfImages:10];