开发者

UITableView cells cannot be selected

开发者 https://www.devze.com 2023-01-17 18:35 出处:网络
When I select a row on my UITableView, the call to the handler is never made... - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath

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 chang开发者_StackOverflowed the cells from my custom ones to regular UITableViewCells and I still can't select cells.


Try:

- (void)tableView:(UITableView *)tv didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    [tv deselectRowAtIndexPath:indexPath animated:YES];
}


I know this question has been posted long time ago but here is my answer for whom still stuck with this one:

   tableView.allowsSelectionDuringEditing = YES;
0

精彩评论

暂无评论...
验证码 换一张
取 消