death7eater
death7eater

Reputation: 1134

didSelectRowAtIndexPath is not working

In my app I want to catch reactions from my UITableView but I do not why it doesn't work:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
 NSLog(@"touched!");
}

I defined the delegate

@interface TableViewController : UIViewController <UITableViewDelegate>

I ticked the "user interaction enable" from the nib file showed the delegate to the files owner.

I also write tableView.delegate = self; to the viewDidLoad. What am I missing?

Upvotes: 0

Views: 665

Answers (3)

Vishal
Vishal

Reputation: 8256

Try making the delegates connection in the IB. and check that you declare this:UITableViewDataSource

along with UITableViewDelegate.

Upvotes: 3

akshaynhegde
akshaynhegde

Reputation: 1938

Set the datasource for your table. Put some data in the table n then see if the delegate is called. If it still doesn't then, usually the problem with delegate not getting called is that its not getting set properly.! so, double check your code..:)

Upvotes: 2

Eric
Eric

Reputation: 4061

Be sure you have the UITableViewDataSource delegate in your header as well.

Upvotes: 2

Related Questions