Possible Duplicate:
access to array object
i have an array that contain images and an imageview in my xib file. now, i want to view in my imageview the first object(image) that my array contain. i tried to do it for couple hours but i didn't succeed. how can i do it??
mt array deceleration:
photoArray = [[NSMutableArray alloc] init];
PhotoItem *photo1 = [[PhotoItem alloc] initWithPhoto:[UIImage imageNamed:@"1.jpg"] name:@"roy rest" photographer:@"roy"];
PhotoItem *photo2 = [[PhotoItem alloc] initWithPhoto:[UIImage imageNamed:@"2.jpg"] name:@"roy's hand" photographer:@"roy"];
PhotoItem *photo3 = [[PhotoItem alloc] initWithPhoto:[UIImage imageNamed:@"3.jpg"] name:@"sapir first" photographer:@"sapir"];
PhotoItem *photo4 = [[PhotoItem alloc] initWithPhoto:[UIImage imageNamed:@"4.jpg"] name:@"sapir second" photographer:@"sapir"];
[photoArray addObject:photo1];
[photoArray addObject:photo2];
[photoArray addObject:photo3];
[photoArray addObject:photo4];
the code that i tried to work with:
imgView = [[UIImageView alloc] initWithImage:[photoArray objectAtIndex:0]];
thanks!!