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?

Answers


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..:)


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

along with UITableViewDelegate.


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


Need Your Help

Help with refactoring to an Action<T> delegate

c# generics refactoring

In a test method (for a Fluent NHibernate mapping, although that's not really relevant) I have the following code wrapped in a bunch of usings and try/catch blocks:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.