iphone - How to pass the number of row selected from didSelectRowAtIndexPath to initWithNibName? -


i have tableview (first view) , detailview (next view) containing details of table.

now on selecting particular row first view want pass index number of selected row didselectrowatindexpath of first view initwithnibname of next view. how can that?

you can implement own method in view controller want instantiate , call method instead of -initwithnibname:bundle:. in method, call

// in view controller - (id)initwithnibname:(nsstring *)nibname bundle:(nsbundle *)nibbundle index:(nsinteger)index {     [self initwithnibname:nibname bundle:nibbundle];     // stuff index here }  // in table view delegate - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath {     detailview *vc = [[detailview alloc] initwithnibname:@"yournibname" bundle:nil index:indexpath.row];     [self.navigationcontroller pushviewcontroller:vc animated:yes];     [vc release]; } 

Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -