Fashion icon indicating copy to clipboard operation
Fashion copied to clipboard

Changing styles in case of table cell selection not working

Open dinarajas opened this issue 8 years ago • 2 comments

First of all, very thank you for this nice library.

I tried to change the style of tableViewCell title when user selects the cell item. But, it doesn't seem to be changing the style.

For e.g., In my custom cell,

    override func setHighlighted(_ highlighted: Bool, animated: Bool) {
        super.setHighlighted(highlighted, animated: animated)
        if (highlighted) {
            styles = LabelStyle.mainMenuCellSelected.rawValue
            highlightedView.isHidden = false
        } else {
            styles = LabelStyle.mainMenuCellNormal.rawValue
            highlightedView.isHidden = true
        }
    }

It's not changing the style at all. Correct me If I missed anything obvious. Any help would be appreciated.

dinarajas avatar Jan 27 '17 11:01 dinarajas

Hi @dineshrajas. Don't see anything wrong with your code, are you sure you register you styles and stylesheet with Fashion.register? Have you tried to change color directly in setHighlighted method to see that it's being called?

vadymmarkov avatar Jan 31 '17 17:01 vadymmarkov

Yeah, I tired. @vadymmarkov

It was working if I change the color directly. I haven't gone through your code. But, I think it's not updating the style every time when you change it. But, only when the cell is awakeFromNib.

Also, yes, that style is registered already with Fashion.

dinarajas avatar Jan 31 '17 17:01 dinarajas