Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ios7 new pan gesture to go back in navigation stack does not clear tableview selection

I have a Notes-like app: uitableviewcontroller showing up individual notes by pushing them onto navigation stack). And I decided to use an ios7 Back button and a pan gesture recognizer coming with it.

My only modification is removing text from the button by setting navigationItem title of the from-controller to an empty string before pushing the detail-view-controller, as it is advised at https://stackoverflow.com/questions/18870128/ios-7-navigation-bar-custom-back-button-without-title

The button itself works just fine, but when I am going back from my note to the notes table view by means of the pan gesture, tableview selection is not cleaned! The row of the note I've just transitioned from is still shown as a selected one. Any ideas what could be wrong here?

I've checked the standard Notes app and it works like a charm.

like image 743
YuliaSh. Avatar asked Sep 26 '13 19:09

YuliaSh.


1 Answers

This answer did help me: https://stackoverflow.com/questions/897071/iphone-uitableview-cells-stay-selected

- (void) viewWillAppear:(BOOL)animated {
    [self.tableView deselectRowAtIndexPath:[self.tableView indexPathForSelectedRow] animated:animated];
    [super viewWillAppear:animated];
}
like image 191
YuliaSh. Avatar answered Jan 25 '23 23:01

YuliaSh.