Skip to main content
Updated the answer to handle the corner case when we this code doesn't work
Source Link

For me, the following worked fine:

tableView.allowsSelection = NO;

tableView.allowsSelection = false 

This means didSelectRowAt# simply won't work. That is to say, touching a row of the table, as such, will do absolutely nothing. (And hence, obviously, there will never be a selected-animation.)

(Note that if, on the cells, you have UIButton or any other controls, of course those controls will still work. Any controls you happen to have on the table cell, are totally unrelated to UITableView's ability to allow you to "select a row" using didSelectRowAt#.)

Another point to note is that: This doesn't work when the UITableView is in editing mode. To restrict cell selection in editing mode use the code as below:

tableView.allowsSelectionDuringEditing = false 

For me, the following worked fine:

tableView.allowsSelection = NO;

This means didSelectRowAt# simply won't work. That is to say, touching a row of the table, as such, will do absolutely nothing. (And hence, obviously, there will never be a selected-animation.)

(Note that if, on the cells, you have UIButton or any other controls, of course those controls will still work. Any controls you happen to have on the table cell, are totally unrelated to UITableView's ability to allow you to "select a row" using didSelectRowAt#.)

For me, the following worked fine:

tableView.allowsSelection = false 

This means didSelectRowAt# simply won't work. That is to say, touching a row of the table, as such, will do absolutely nothing. (And hence, obviously, there will never be a selected-animation.)

(Note that if, on the cells, you have UIButton or any other controls, of course those controls will still work. Any controls you happen to have on the table cell, are totally unrelated to UITableView's ability to allow you to "select a row" using didSelectRowAt#.)

Another point to note is that: This doesn't work when the UITableView is in editing mode. To restrict cell selection in editing mode use the code as below:

tableView.allowsSelectionDuringEditing = false 
added 189 characters in body
Source Link
Fattie
  • 9.8k
  • 76
  • 455
  • 769

For me, the following worked fine:

tableView.allowsSelection = NO;

This means didSelectRowAt# simply won't work. That is to say, touching a row of the table, as such, will do absolutely nothing. (And hence, obviously, there will never be a selected-animation.)

(Note that if, on the cells, you have UIButton or any other controls, of course those controls will still work. Any controls you happen to have on the table cell, are totally unrelated to UITableView's ability to allow you to "select a row" using didSelectRowAt#.)

For me, the following worked fine:

tableView.allowsSelection = NO;

For me, the following worked fine:

tableView.allowsSelection = NO;

This means didSelectRowAt# simply won't work. That is to say, touching a row of the table, as such, will do absolutely nothing. (And hence, obviously, there will never be a selected-animation.)

(Note that if, on the cells, you have UIButton or any other controls, of course those controls will still work. Any controls you happen to have on the table cell, are totally unrelated to UITableView's ability to allow you to "select a row" using didSelectRowAt#.)

`NO`, not `false`
Source Link
Tim Sullivan
  • 17k
  • 12
  • 77
  • 120

For me, the following worked fine:

tableView.allowsSelection = false;NO;

For me, the following worked fine:

tableView.allowsSelection = false;

For me, the following worked fine:

tableView.allowsSelection = NO;

Source Link
Paulo De Barros
Paulo De Barros
Loading