How to disable the UITableView selection?

Posted by Rohit Kumar | Updated on

Want to disable the UITableView selection. For me, the following worked fine:

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:

If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@] Your question and answer will appear on and help other developers.

Related Questions & Answers