belgrim
belgrim

Reputation: 123

Custom tableview cell not deselecting when I return?

I created a custom table view cell. I added a black transparent overlay image for when the user presses the cell. It works great, however, when you go back to the tableview the cell is still selected. Here is my code.

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {

    let selectedCell: PackCell = tableView.cellForRow(at: indexPath)! as! PackCell
    selectedCell.highlightImage.isHidden = false

    performSegue(withIdentifier: segueIdentifiers[indexPath.row], sender: self)

    tableView.deselectRow(at: indexPath, animated: true)

}

Upvotes: 0

Views: 45

Answers (1)

qtngo
qtngo

Reputation: 1679

Maybe you should also hide your highlightImage when come back?

selectedCell.highlightImage.isHidden = true

Upvotes: 2

Related Questions