Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS: Tapping on UITableView does not call didSelectRowAtIndexPath

My app uses a UITableView with a UINavigationController to show a more detailed view when a row of the table is tapped - the basic drill-down routine.

When I tap on a row, it is highlighted, but the delegate methods tableView:willSelectRowAtIndexPath: or tableView:didSelectRowAtIndexPath: are not called (verified using debugger).

Now here's the weird part:

  1. There are some other table views in the app (they don't drill down) and none of them exhibit the issue.

  2. If I tap the row rapidly and repeatedly, after many tries (10 - 20 is normal), tableView:willSelectRowAtIndexPath: and tableView:didSelectRowAtIndexPath: are called and processing continues normally.

  3. The problem occurs only on an (any, actually) iPad running iOS 6. It works fine with iPads running iOS 5, or with any iPhone running any iOS version, 6. It also works with the iPad simulator using iOS 5 or 6.

So it seems that something is receiving the tap before the delegate methods are called. But what?

I not using any UITapGestureRecognizer, so that is not the issue. I am not using multiple UITableViewControllers for the table, so this is also not the issue.

like image 522
Anton Meyer Avatar asked Sep 26 '12 20:09

Anton Meyer


1 Answers

I was having this issue with an app when running in iOS6. The tableView:didSelectRowAtIndexPath: method was never being triggered, even though it was working before updating to iOS6.

I finally figured it out by looking at the xib and the attribute inspector for the table. In the Table View section I had the Selection option set to No Selection and Show Selection on Touch was not selected.

Changing the Selection option to Single Selection actually got this working for me again and leaving the Show Selection on Touch unselected means that I don't see any flash or change of colour when the row is selected.

like image 63
AidenMontgomery Avatar answered Nov 09 '22 23:11

AidenMontgomery