ios - Inherit from tableViewController -
i have myvc inherited tableviewcontroller.
now inherit myvc in detailvc.
i want have tableview in myvc , cell in detailvc. (i have difficult cell construction) have full implementation of myvc in detailvc(with myvc's navigation buttons).
how can have table 1 cell in detailvc?
create model containing cell components name,occupation etc. store data populating table cells in array. in
- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath
method
self.timesheetmodel = [self.timesheetlistarray objectatindex:indexpath.row];
in
- (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { self.detailvc = [[detailvc alloc]init]; //create property model in detailvc assign it. self.detailvc.model = [self.timesheetlistarray objectatindex:indexpath.row]; //pass model . data in detailvc of selected cell. [self.navigationcontroller pushviewcontroller:self.detailvc animated:yes]; }
in detailvc can access values directly
self.mynamelabel.text = self.model.name;
Comments
Post a Comment