Home > DeveloperSection > Forums > How can I disable the UITableView selection highlighting?
Samuel Fernandes
Samuel Fernandes

Total Post:155

Posted on    April-25-2015 1:36 AM

 iPhone iPhone  Ios  Objective C 

 1 Reply(s)
 472  View(s)
Rate this:
When you tap a row in a UITableView, the row is highlighted and selected. Is it possible to disable this so tapping a row does nothing?

Mayank Tripathi
Mayank Tripathi

Total Post:397

Posted on    April-25-2015 7:36 AM

For me, the following worked fine:

tableView.allowsSelection = NO;

All you have to do is set the selection style on the UITableViewCell instance using either:

cell.selectionStyle = UITableViewCellSelectionStyleNone;

[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
Further, make sure you either don't implement -tableView:didSelectRowAtIndexPath: in your table view delegate or explicitly exclude the cells you want to have no action if you do implement it.

Don't want to miss updates? Please click the below button!

Follow MindStick