1

I am currently working with TableViewCells in xCode and I am wondering if there is a way to make the cell not be highlighted/selected whenever it is tapped on. The answer can be either in code or by using the Interface Builder.

If I am not being specific enough or if you are confused as of what I am asking, please let me know and I will clarify. Thank you.

Swope
  • 13
  • 5
  • See https://stackoverflow.com/questions/190908/how-can-i-disable-the-uitableview-selection-highlighting?rq=1 – Mike Taverne Apr 25 '18 at 14:24
  • Have a look at [this](https://stackoverflow.com/questions/2641530/how-to-make-a-cell-on-a-uitableview-not-selectable/17607210?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa) question, especially the comment on the accepted answer – instanceof Apr 25 '18 at 14:24
  • If you want to keep the cell clickable and only not animate when being clicked, use `cell.selectionStyle = .none` inside `cellForRow` method. – ZassX Apr 25 '18 at 14:25
  • **cell.selectionStyle = .none** – iDeveloper Apr 25 '18 at 14:53
  • Thank you, and I did not see this question already answered during my search so I am sorry for that. – Swope Apr 26 '18 at 13:04

1 Answers1

3

You can turn off all selection in the UITableView by setting allowsSelection to false.

If you want to do it on individual cells, set the cell SelectionStyle to .none and userInteractionEnabled to false

Scriptable
  • 17,875
  • 4
  • 50
  • 65