foxpaul
foxpaul

Reputation: 67

Using a UITable in a UIViewController

I've got a UIViewController with a xib view that has a button and a table. Everything is wired up, the data has rows in it etc. But if i click a row and navigate away from this initial screen, then go back, the cell in the table still has the highlighted state on it. Do i need to implement methods other than numberOfSectionsInTableView, tableView:cellForRowAtIndexPath and tableView:didSelectRowAtIndexPath?

Upvotes: 0

Views: 104

Answers (1)

Noah Witherspoon
Noah Witherspoon

Reputation: 57149

Implement -viewWillAppear: on your view controller and deselect the table's currently-selected row, something like this:

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [self.tableView deselectRowAtIndexPath:[self.tableView indexPathForSelectedRow] animated:animated];
}

Upvotes: 1

Related Questions