iphone - Populate a UIImageView from a .plist -
i have .plist references paths .png files ( key value = "maps" ). able add images array using code while loading view:
-(void)viewdidload { nsstring *path = [[nsbundle mainbundle] pathforresource:@"countries" oftype:@"plist"]; nsarray *countries = [nsarray arraywithcontentsoffile:path]; nssortdescriptor *descriptor = [[[nssortdescriptor alloc] initwithkey:@"maps" ascending:no] autorelease]; self.sortedcountries = [countries sortedarrayusingdescriptors:[nsarray arraywithobject:descriptor]]; }
i able add images tableviewcells using method:
-(uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {}
what trying add these same images instance of uiimageview in new viewcontroller. have viewcontroller set properly, how can pull images array display in uiimageview did uitableviewcells?
when selecting row of table following method call-
- (nsindexpath *)tableview:(uitableview *)tableview willselectrowatindexpath:(nsindexpath *)indexpath { userdetailvc* userdetailvc=[[userdetailvc alloc] initwithnibname:@"userdetailvc" bundle:nil]; [userdetailvc autorelease]; //imp- set image on here nsdictionary* tempdict=[yourarray objectatindex:indexpath.row]; userdetailvc.selectedimageview.image=[tempdict objectforkey:@"imagename"]; [self.navigationcontroller pushviewcontroller:userdetailvc animated:yes]; return nil; }
so tried this, gone you.
Comments
Post a Comment