当用户滑动时,表视图单元格高亮显示

4

我想为UITableViewCell创建行动操作,但在滑动时出现了高亮问题。用户并没有真正选择单元格,而是向左滑动。

我的shouldHighlightRowAtIndexPath代码如下:

    - (BOOL)tableView:(UITableView *)tableView shouldHighlightRowAtIndexPath:(NSIndexPath *)indexPath {

       // Sets the inner rectangle to the selected color
        [cell setCellColorWithString:COLORS_ARRAY[4]];
        
        return YES;
    }

我的editActionsForRowAtIndexPath如果需要的话会取消突出显示,但是它调用太晚了 :/

当用户开始/停止向左/右滑动时,我能得到任何事件吗?

任何帮助都将是伟大的。提前感谢。

enter image description here

1个回答

0
你可以给表格视图添加一个滑动手势识别器,找到与滑动触摸点匹配的单元格,然后取消其高亮状态。
参见这个答案

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接