Daniele B Daniele B - 7 months ago 22
Swift Question

UITableView: Resetting Cell Selections

How can I reset cell selections in a

UITableView
?

Use case:

I have a
ViewController
with a
UITableView
. I select a cell and I enter another
View Controller
. When I come back to the
TableViewController
, I still see the selected cell. I would like to reset any selection.

Answer

In:

override func tableView (tableView:UITableView, didSelectRowAtIndexPath indexPath:NSIndexPath)

You could do the following:

tableView.deselectRowAtIndexPath(indexPath, animated:false)