How to perform a cell deselection when a user returns to a table view?

Posted by Panagiotis Korros on Stack Overflow See other posts from Stack Overflow or by Panagiotis Korros
Published on 2009-04-22T13:53:55Z Indexed on 2010/04/02 17:23 UTC
Read the original article Hit count: 181

Filed under:
|
|

I am using a UITableView to display a list of cells, when the user selects a cell then a new view appears by using the following code:

- (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
     [self.navigationController pushViewController: detailsViewController animated: TRUE];
}

By using the code above, the view is displayed correctly, but when I return back to the root table view, then the cell is still selected. I noticed, in many sdk examples, that the cell is deselected (with a nice animation) when the root view is poped pack, but I could not find the code that implemented this feature in any of the examples. I know that I can use:

[tableView deselectRowAtIndexPath:indexPath animated: YES];

to implement this, but I am very curious on how these examples do it without using any code.

Any ideas?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about iphone-sdk