0
votes

I have a UITableView as an instance variable of a UIViewController which is also a UITableViewDelegate and UITableViewDataSource. The table is fixed and shorter than the screen height, so scrolling is disabled. Row selection works if you treat it very gently - a firm press with no sliding directly on the row is fine.

But any sort of quick tap, some sliding, or multitouch on the table causes the rows to flicker and no call to didSelectRowAtIndexPath is sent. For example, if row 0 is selected and currently highlighted, when you press down on row 2, it will highlight, then drag down towards row 3, nothing will be highlighted, and on lifting your finger, row 0 highlights.

Can this be improved? Is this expected behavior? Deliberate dragging is probably an intentional cancel anyways, but quick taps are something that I'd rather capture more reliably than it seems to be doing now.

here's the code where I set up the tableview:

tableView2 = [[UITableView alloc]initWithFrame:CGRectMake(self.view.frame.origin.x, self.view.frame.origin.y + HEADERANDFOOTERHEIGHT,
                                                          LEFTIMPORTWIDTH, self.view.frame.size.height - HEADERANDFOOTERHEIGHT * 2)];

[tableView2 setDataSource:self];
[tableView2 setDelegate:self];
tableView2.scrollEnabled = NO;
tableView2.exclusiveTouch = YES;
tableView2.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"bkg_ptn_darkgraynoise.png"]];
[tableView2 setSeparatorStyle: UITableViewCellSeparatorStyleNone];
[tableView2 setRowHeight:52.0f];
[self.view addSubview:tableView2];

But I don't think there's anything odd going on in that code. I think it's just a case of me expecting better performance than the default behavior is?

1
What's exclusiveTouch for?Undo
Was mostly an attempt to improve/change this behavior, to make sure the tableview was the only thing the user was interacting with. It's unnecessary, but removing it doesn't change the behavior. I'm leaning more and more towards this actually being working as intended.Tasonir

1 Answers

0
votes

In the end I'm going to enable scrolling. Even though the menu will never need to be scrolled, it feels more intuitive that something happens if you accidentally drag your finger along the menu.

If I was doing it all again I'd probably make it a list of buttons rather than a UITableView, but it's a relatively minor issue.