ios - How to get cell selection on touchdown? -


i have custom tablecell , trying show different icon when it's selected. problem icon changes after touchup , not right after touchdown (unlike selection background image). there way change behaviour?

override func setselected(selected: bool, animated: bool) {     super.setselected(selected, animated: animated)      let cell = self     if (selected) {          cell.imageview?.image = uiimage(named: (selectediconname!))      } else {          cell.imageview?.image = uiimage(named: (iconname!))      } 

you can use sethighlighted instead of setselected that:

override func sethighlighted(highlighted: bool, animated: bool) {     super. sethighlighted(highlighted, animated: animated)      let cell = self     if (highlighted) {          cell.imageview?.image = uiimage(named: (selectediconname!))      } else {          cell.imageview?.image = uiimage(named: (iconname!))      } } 

Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -