Closed afestein closed 8 years ago
Hi @afestein. Are you trying to make it so that when you tap on a row, it stays selected? I don't think UITableViewCells work that way by default. You can try setting keep_selection: true
. Alternatively, if you're trying to create a sort of checklist, you might consider changing the accessory view to a checkmark.
Thanks for the reply and suggestions. Yes I was trying to get the cell to stay highlighted and a checkmark accessory was the decoration I needed. I tried this a lot of different ways and couldn't seem to get an accessory to show for a selected cell (and I needed to keep track of the selected cell).
I ended up using a custom cell class extending PM::TableViewCell
and then a motion-kit layout to build the background I needed using selectedBackgroundView
.
Ah, okay. So you found a solution? Is it okay if we close this issue then?
I did find a solution, but I think it's still unexplained why selection_style: :blue
has no effect in the code I'm using above. I'd expect a blue selection style of some kind to appear, but here's what I get:
The reason is that blue no longer means blue. From the Apple docs:
In iOS 7, the selection color is no longer blue. Use UITableViewCellSelectionStyleDefault instead.
So I guess it's still around for legacy support. If you'd like, do you mind sending a PR that makes note of that change?
Hey guys,
I'm struggling to get
selection_style
working on a very simple table:According to the docs I think I'm using it correctly.
I'm expecting that when tapping a row it will turn blue, in reality it adopts the 'highlighted' style for a moment and then goes back to a white background:
I've checked the value of
table_view.allowsSelection
and it's set totrue
.Does anybody please have any ideas or suggestions?
Many thanks.