Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UITableView cells cannot be selected

Tags:

uitableview

When I select a row on my UITableView, the call to the handler is never made...

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath

I create the custom cells programmatically. User interaction is enabled on my UITableView and the data source and delegate are set to the File's Owner for the view controller the tale resides in. I am able to insert data, but touches are not detected. The cells do not even turn blue.

What am I missing?

I tried setting the table to allow selection:

   tableView.allowsSelection = YES;

EDIT:

More details - I have a NSLog in the didSelectRowAtIndexPath and it never gets printed. The cell does not even turn blue or look selected.

I changed the cells from my custom ones to regular UITableViewCells and I still can't select cells.

like image 945
Mark Avatar asked Sep 23 '10 04:09

Mark


1 Answers

Try:

- (void)tableView:(UITableView *)tv didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    [tv deselectRowAtIndexPath:indexPath animated:YES];
}
like image 117
Matt Williamson Avatar answered Oct 25 '22 02:10

Matt Williamson