UITableView didSelectRowAtIndexPath: not being called on first tap

I'm having an issue with UITableView's didSelectRowAtIndexPath .

My table is setup so that when I select row it initializes a new view controller and pushes it.

The first time I tap any row in the table, the method does not get called. Once I select another row, it begins to work as normal.

I have verified this by setting a breakpoint on didSelectRowAtIndexPath . When adding an NSLog to the method I see that when I select the second row that finally pushes the new view controller, I see two log statements appear in the console at the same time.

Any suggestions?


你有意无意地输入了didDeselectRowAtIndexPath?


Also check the selection property of your table view in xib file. Use 'Single Selection' or 'Multiple Selection' as required.


I experienced the following issue:

  • first tap in row -> no effect, no selection, never
  • second tap and following -> correct selection behavior, always
  • In my case, my error was checking Show Selection on Touch in Interface Builder. You can uncheck it in IB here:

    在这里输入图像描述

    Hope that helps someone

    链接地址: http://www.djcxy.com/p/49400.html

    上一篇: UITableview:如何禁用某些行而不是其他的选择

    下一篇: UITableView didSelectRowAtIndexPath:在第一次点击时不被调用