我是 Xcode 的新手,我试图从数组中提取一堆图片并将它们放在屏幕上,但是通过调试器我看到我的 for 循环没有运行。
for (int i = 0; i <[imagePaths count]; i++)
{
NSLog(@"I'm loading a card");
UIImageView *imgView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 250, 350)];
NSString *imgFilepath = [[NSBundle mainBundle] pathForResource:[imagePaths objectAtIndex:i] ofType:@"jpg"];
UIImage *img = [[UIImage alloc] initWithContentsOfFile:imgFilepath];
[imgView setImage:img];
[self.view addSubview:imgView];
}
有谁看到我缺少什么来完成这项工作?