ios - didDeselectRowAt never called -


this question has answer here:

i have uitableview, uitableviewdelegate set this:

    tableview = uitableview()     tableview.delegate = self     tableview.datasource = self 

in delegate implement (among others) functions

  • func tableview(_ tableview: uitableview, didselectrowat indexpath: indexpath)
  • func tableview(_ tableview: uitableview, diddeselectrowat indexpath: indexpath)

my custom cell inherits uitableviewcell overrides setselected way:

override func setselected(_ selected: bool, animated: bool) {     super.setselected(selected, animated: animated)      if selected {         // visual updates (with small animation)     } else {         // visual updates     } } 

the problem that, when tapping on cell, didselectrowat called , never diddeselectrowat, hence, cell shown selected. doing wrong??

you have implement this:

yourtableview.deselectrow(at: indexpath, animated: true) 

in didselectrowat method or in diddeselectrowat method.

hope helpful :)


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -