Why does UITableViewCell remain highlighted?

前端 未结 18 1292
余生分开走
余生分开走 2020-12-12 12:45

What would cause a table view cell to remain highlighted after being touched? I click the cell and can see it stays highlighted as a detail view is pushed. Once the detail

18条回答
  •  情深已故
    2020-12-12 13:17

    I am using CoreData so the code that worked for me was a combination of ideas from various answers, in Swift:

    override func viewDidAppear(_ animated: Bool) {
        if let testSelected = yourTable.indexPathForSelectedRow {
            yourTable.deselectRow(at: testSelected, animated: true)
        }
        super.viewDidAppear(true)
    }
    

提交回复
热议问题