ios - how to pass an image from collection view to detail view in iphone -



ios - how to pass an image from collection view to detail view in iphone -

retrieving info remote xml, can show images in collection view. collection view i'm trying display detailed view controller, if image clicked in collection view controller should display image in detailed view. got stuck here can't show detail view controller. going wrong? kindly guide me.

below collection view controller,

- (void)viewdidload { [super viewdidload]; xmlparser = [[myxmlparser alloc] loadxmlbyurl:@"http://myxml.com/sample.xml"]; myarray = xmlparser.arrayofimages; } -(nsinteger)numberofsectionsincollectionview:(uicollectionview *)collectionview { homecoming 1; } -(nsinteger)collectionview:(uicollectionview *)collectionview numberofitemsinsection:(nsinteger)section { homecoming [myarray count]; } - (uicollectionviewcell *)collectionview:(uicollectionview *)collectionview cellforitematindexpath:(nsindexpath *)indexpath { mycollectionviewcell *mycell = [collectionview dequeuereusablecellwithreuseidentifier:@"mycell" forindexpath:indexpath]; if (!mycell) { mycell = [[mycollectionviewcell alloc] initwithframe:cgrectmake(0,0,mycell.frame.size.width , mycell.frame.size.height)]; } [mycell.tweetimageview setimage:[myarray objectatindex:indexpath.row]]; homecoming mycell; } - (void)collectionview:(uicollectionviewcell *)collectionview didselectrowatindexpath:(nsindexpath *)indexpath { detailviewcontroller *detailvc = [[detailviewcontroller alloc] initwithnibname:@"mycell" bundle:[nsbundle mainbundle]]; detailvc.img= [myarray objectatindex: indexpath.row]; [self presentviewcontroller:detailvc animated:yes completion:nil]; }

detailview controller

-(void)viewdidload { [super viewdidload]; self.imageview.image = self.img; }

try in collection view controller,

[self.navigationcontroller pushviewcontroller:detailvc animated:yes];

you had missed line.

iphone ios ios6

Comments