I have a UITableView
inside a UIViewController
that adopts UITableViewDelegate
& UITableViewDataSource
protocols. numberOfRowsInSection
and cellForRowAtIndexPath
are implemented.
There are outlets for dataSource & delegate in storyboard. Single selection is chosen for TableView. Show selection on touch is checked.
I run project on the simulator, touch table cell, got didHighlightRowAtIndexPath
call, but didSelectRowAtIndexPath
or willSelectRowAtIndexPath
are never called.
What did I forgot? What can affect TableView in this way?
P.S. I know, there is a plenty of questions like this, but I've spent a few hours googling and reading stackoverflow and still didn't solve my problem.
TestViewController.h:
@interface TestViewController : ViewController <UITableViewDelegate, UITableViewDataSource>
@end
TestViewController.m:
@interface TestViewController ()
@property (strong) IBOutlet UITableView *tableView;
@end
@implementation TestViewController
- (void)viewDidLoad
{
[super viewDidLoad];
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(@"selected");
}
- (void)tableView:(UITableView *)tableView didHighlightRowAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(@"highlighted");
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 2;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 10;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"FilterCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
cell.textLabel.text = @"some text";
return cell;
}
@end