如何从imageview中显示的plist文件中检索图像数组?

时间:2012-07-07 08:57:21

标签: objective-c

我已经把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]]];
    }
}

0 个答案:

没有答案