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
Post a Comment