简体   繁体   English

用户滑动时,表格视图单元格突出显示

[英]Table View Cell highlight when user swipe

I try to make row action for UITableViewCell and I have a problem with highlight while swipe. 我尝试为UITableViewCell进行行动, 在刷卡时遇到问题 The user doesn't really select the cell, he simply swipe to left. 用户并没有真正选择单元格,他只需向左滑动即可。

My shouldHighlightRowAtIndexPath looks like this: 我的shouldHighlightRowAtIndexPath看起来像这样:

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

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

        return YES;
    }

And my editActionsForRowAtIndexPath cancel the highlight if this is the right thing to do, but it called too late :/ 如果这是正确的事情,我的editActionsForRowAtIndexPath取消突出显示,但它调用太晚了:/

Can I get any event when the user start/stop swipe to left/right? 当用户开始/停止向左/向右滑动时,我可以获得任何事件吗?

Any help will be great. 任何帮助都会很棒。 Thanks in advance. 提前致谢。

在此输入图像描述

You could add a swipe gesture recogniser to the table view, find the cell that matches the touch point of the swipe and then unhighlight it. 您可以向表格视图添加滑动手势识别器,找到与滑动触摸点匹配的单元格,然后取消它。

See this answer 看到这个答案

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 刷卡时,为什么在桌面视图的单元格中扰乱我的观点? - Why disorder my views in cell of table view when swipe a cell? 向左或向右滑动即可将集合视图单元格突出显示加载到视图控制器中 - Swipe left or right to load the view controller with the collection view cell highlight 当用户未完全滑动以删除表格视图单元格时,如何禁用/启用编辑按钮? - How do i disable/enable edit button when user doesn't fully swipe to delete table view cell? Swift 3-如何滑动删除表格视图单元格? - swift 3 - how to swipe remove table view cell? 快速禁用表格视图单元格中的滑动操作 - Disable the swipe action in table view cell in swift iOS表格视图单元格突出显示边框错误 - iOS table view cell highlight border bug 单击时突出显示表视图单元,而不是在发布时 - Highlight table view cell on click, not on release UIPanGestureRecognizer当滑动单元格以显示更多按钮时,如果用户滑动不到一半,如何使视图反弹 - UIPanGestureRecognizer when swipe cell for more buttons how to make view bounce back if user swipes less than halfway 滑动删除表格单元格时出错 - Error when swipe to delete a table cell 目标C:如何在加载视图时突出显示表视图中的第一个单元格? - Objective C: How to highlight the first cell in table view when view loads?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM