1

我已经在图像数组中获取了 plist 文件...在该通道中,有五个图像,但是如何在我们的视图中检索这些图像?

我的代码是:

- (void)viewDidLoad
{
    [super viewDidLoad];
    NSString *path=[[NSBundle mainBundle] pathForResource:@"Animalfile" ofType:@"plist"];
    NSArray *animalImages=[NSArray arrayWithContentsOfFile:path];
    NSMutableArray *animal=[[NSMutableArray alloc]init];
    for(int i=0;i<[animalImages count];i++)
    {
        UIImage *img=[animalImages objectAtIndex:i];
        [animalphoto setImage:img];
        NSLog(@"print:%@",i);

        //NSString *name=[animalImages objectAtIndex:i];
        [animal addObject:[UIImage imageNamed:[NSString stringWithFormat:@"%@.png",img]]];
    }
}
4

0 回答 0