iOS How to deselect a cell which was tapped by user.
Introduction
This article shows how to deselect an cell when user tapped it.
Solution
It's a easy way to do it.
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { //Change the selected background view of the cell. tableView.deselectRow(at: indexPath, animated: true) }
At first, I tried to get the cell which was tapped as below.
let cell = tableView.cellForRow(at: indexPath) cell.(SOMETHING)
But, I couldn't find (SOMETHING) method. That's because I wrote this article ;)