I have a cell with a few lines of text which changes colour when selected/highlighted. The problem is that as the new viewController is being pushed, the deselection animati
I think the general paradigm used with table views and pushing new VCs is that you deselect the table row in your viewWillAppear:animated
method. Then as the VC is popped, they see which row had been used to navigate to that VC.
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[self.myTableView deselectRowAtIndexPath:[myTableView indexPathForSelectedRow] animated:YES];
}
so remove deselectRow from your didSelectRowAtIndexPath
method.
If you're using a UITableViewController
, you won't need to call deselectRowAtIndexPath:
. This will be done for you automatically when your table view becomes visible again.
If you're not using a UITableViewController
because you have a more complicated interface, you would need to call deselectRowAtIndexPath:
manually from the viewWillAppear:animated:
method.