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

天涯浪子 提交于 2019-12-06 21:28:46

问题


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.


回答1:


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];
}



回答2:


At least for the cases we were seeing this happen, it seems to be fixed in iOS 7.0.4. (We've actually noticed that a number of glitches with the back gesture have been fixed during the 7.0.x releases.)



来源:https://stackoverflow.com/questions/19036645/ios7-new-pan-gesture-to-go-back-in-navigation-stack-does-not-clear-tableview-sel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!