Skip to main content

objective c - How to retrieve an array of images from a plist file which is displayed in an imageview? -


i have taken plist file in take array of images... in pass, there 5 images, how retrieve these images in our view?

my code is:

- (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]]]; } } 

objective c - how retrieve array of images plist file displayed in imageview? - stack overflow

learn, share, build

each month, on 50 million developers come stack overflow learn, share knowledge, , build careers.

join world’s largest developer community.

sign up

i have taken plist file in take array of images... in pass, there 5 images, how retrieve these images in our view?

my code is:

- (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]]]; } } 
share|improve question

your answer

 
discard

posting answer, agree privacy policy , terms of service.

browse other questions tagged or ask own question.


Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -