is a microblog
home archives search feed blogroll

Why Is didSelectRowAtIndexPath Not Being Called?

There are a few possible causes.

Edit mode is enabled

[tableView setEditing:NO];

User interaction is not enabled

[tableView setUserInteractionEnabled:YES];

Delegate is not set

In your header file:

@interface YourViewController : UIViewController <UITableViewDelegate>

In viewDidLoad of your implementation file:

[tableView setDelegate:self];

Selection is not enabled

[tableView setAllowsSelection:YES];

First responder issue

If nothing above worked, it’s most likely a first responder issue.

You might have a UIView inside your row that is a first responder and takes your clicks away. Say a UIButton or something similar.”

- gilm on Stack Overflow

Posted on 2018-03-26   #ios     #objc  

← Next post    ·    Previous post →