ios - Tableview and UIbutton simultaneously touchdownpress registered input order on which button is let loose first -
the following problem occurs in project, when pressed , hold backbutton (uibarbuttonitem) , tableview row. , letting go tableview row , followed letting go backbutton following error occurs:
terminating app due uncaught exception 'nsrangeexception', reason: '*** -[__nsarraym objectatindex:]: index 1 beyond bounds [0 .. 0]'.
i have figured out problem here tableview didselectrowatindexpath has wrong indexpath.
case: uibarbuttonitem , tableview row pressed , hold simultaneously.
in situation 1: uibarbuttonitem letting go , followed letting go tableview row. result: selector uibarbuttonitem called. (in case no error.)
in situation 2: tableview row letting go , followed letting go uibarbuttonitem. result: selector uibarbuttonitem called , followed delegate methods of tableview. (in case error above occurs.)
- (void)backbutton { self.itemlist = [self getolditem]; [self.tableview reloaddata]; } - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { // crash on line. model *model = [[self.itemlist objectatindex:indexpath.section] objectatindex:indexpath.row]; [model show]; }
does know if normal behavior order selector methods of button called? , how should handle this?
Comments
Post a Comment