How to unselect a uitableview cell when the user returns to the view controller

If you using UITableViewController subclass then just set property

self.clearsSelectionOnViewWillAppear = YES;

else in viewWillAppear just call

NSIndexPath *indexPath = self.tableView.indexPathForSelectedRow;
if (indexPath) {
    [self.tableView deselectRowAtIndexPath:indexPath animated:animated];
}

// MARK: - Swift 3
if let indexPath = tableView.indexPathForSelectedRow {
    tableView.deselectRow(at: indexPath, animated: true)
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)