ios - Tableview reload data not updating tableView -
the else part of works fine. if itemflag true, can't new information display correctly after doing alphabetic sort. quitting programme , restarting shows new item have been added array, , diplayed correctly.
so question is, why reloaddata not working if itemflag true?
here code:
- (void)changefooddetails:(nsstring *)foodname withpoints:(nsstring *)foodpoints{ if (newitemflag) { [_foodstuffsarray insertobject:[[fooditem alloc] initwithname:foodname points:[foodpoints intvalue]] atindex:0]; nsindexpath *indexpath = [nsindexpath indexpathforrow:0 insection:0]; [self.tableview insertrowsatindexpaths:[nsarray arraywithobject:indexpath] withrowanimation:uitableviewrowanimationautomatic]; [sharedmanager sortfoodstuffarraybyname]; [self.tableview reloaddata]; newitemflag = false; }else { [_foodstuffsarray removeobjectatindex:currentfoodstuffarrayentry]; [_foodstuffsarray insertobject:[[fooditem alloc] initwithname:foodname points:[foodpoints intvalue]] atindex:currentfoodstuffarrayentry]; [self.tableview reloaddata]; } }
Comments
Post a Comment