Normally a selected row in a UITableView
gets deselected with an animation when the user pops back from the detail view.
However, in my case where I have a
In swift, you can add the following lines in your viewWillAppear
if let row = tableView.indexPathForSelectedRow() {
tableView.deselectRowAtIndexPath(row, animated: true)
}
In swift 2, it's without parantheses:
if let row = tableView.indexPathForSelectedRow {
tableView.deselectRowAtIndexPath(row, animated: true)
}
In Swift 4 (and 3?) the function name was cleaned up:
if let indexPath = tableView.indexPathForSelectedRow {
tableView.deselectRow(at: indexPath, animated: true)
}