UITableView:首次点击未收到的单元格

时间:2014-10-24 15:14:58

标签: ios uitableview ios8

我在UIViewController上有UITableView,内容比表格区域大一点。当我尝试将bounces属性设置为NO时,在将表格滚动到边界后,单元格的第一次敲击将停止接收。

我创建了一个测试项目来接收这个问题的所有细微差别:

1)滚动前第一次选择正常;

2)滚动后的第二个选择也可以正常工作;

3)没有问题,如果滚动到达边界本身(相反我会用手指滚动并在到达边界后结束触摸);

4)将bounces属性设置为YES解决问题(bcs滚动只能自己到达边界);

5)细胞的亮点始终有效;

6)未收到下一个委托方法(仅在发布错误时才使用)

- (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath
- (NSIndexPath *)tableView:(UITableView *)tableView willDeselectRowAtIndexPath:(NSIndexPath *)indexPath
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
- (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath

UPD:这里有bug的gif,似乎滚动条也没有隐藏,当这个bug发生时

enter image description here

1 个答案:

答案 0 :(得分:1)

看起来像是需要报告的Apple的UITableView错误。这里有一些方法来揭示问题(不好,但有效):

- (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset {
    if (!scrollView.bounces) {
        targetContentOffset->y = -1;
    }
}