HOW CAN I DISABLE THE UITABLEVIEW SELECTION HIGHLIGHTING?

Samuel Fernandes

Total Post:159

Points:1117
Posted by  Samuel Fernandes
 779  View(s)
Ratings:
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?
  1. Mayank Tripathi

    Post:397

    Points:3117
    Re: How can I disable the UITableView selection highlighting?

    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;
    or

    [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.

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!