iphone - Navigating with a UITableView and a detail view -
i sure straight forward application, not sure best way (and new). have navigation controller uitableviewcontroller (all running in uitabviewcontroller).
when user taps row app goes detailed view. trying link left , right swipe gestures navigating previous , next record. right way within detailed view, easiest link tableviewcontroller?
a related question how link 'pull down' same action 'back' button of navigation controller.
i hope above makes sense. million in advance!
i have working kind-of in way like, clumsy. when calling detailview pass parameter pointer 'self' , current 'selectedrow'. when swipe made call function 'movetonextrecord' on tabelviewcontroller (with pointer provided) , have selectedrow parameter. in tableviewcontroller call selectrowatindexpath , didselectrowatindexpath.
-(void)movetonextrecord:(nsindexpath*) selectedrow{ //[self.navigationcontroller popviewcontrolleranimated:yes]; //nsindexpath *selectedrow = [self.tableview indexpathforselectedrow]; nsuinteger row = selectedrow.row; nsuinteger section = selectedrow.section; ++row; if(row >= [self.tableview numberofrowsinsection:selectedrow.section]) { row = 0; ++section; if(section >= [self.tableview numberofsections]) { row = 0; section = 0; } } [self.tableview selectrowatindexpath:[nsindexpath indexpathforrow:row insection:section] animated:yes scrollposition:uitableviewscrollpositionmiddle]; [self tableview:self.tableview didselectrowatindexpath:[nsindexpath indexpathforrow:row insection:section]]; }
this seems work, problem next record slotted after previous one. means back-button brings me previous record , not table view. guess should tell viewcontroller don't want stack them going , select next row, while showing animation directly 1 detailview next. makes sense?
([self.navigationcontroller popviewcontrolleranimated:yes] first fiction not seem work not proper flow.)
from detail view, once recognize gesture, call:
[self.navigationcontroller popviewcontrolleranimated:yes];
this navigate back.
Comments
Post a Comment