尾随滑动动作不解除 [英] Trailing swipe actions not dismissing

查看:28
本文介绍了尾随滑动动作不解除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 UITableView 中配置了尾随滑动操作.操作正常工作,但当操作从表格中删除单元格时,滑动操作会保留在替换已删除行的行上.所以看起来新的当前行被刷了.

I have trailing swipe actions configured in my UITableView. The actions work correctly, but when an action removes the cell from the table, the swipe actions remain over the row that replaces the removed row. So it looks like the new current row is swiped.

而且我认为滑动操作实际上可能会将他们的附件转移到那个新行,我不知道.

And I think the swipe actions may actually transfer their attachment to that new row, I can't tell.

是否有一些我没有意识到需要调用的关闭函数?

Is there some dismiss function I don't realize I need to call?

推荐答案

对于您的上下文操作,不要忘记根据您是否完成操作将完成处理程序设置为 true 或 false:

For your contextual action, don't forget to set your completion handler to true or false based on if you completed the action or not:

    let delete = UIContextualAction(style: .destructive, title: "Delete") { (myContext, myView, complete) in

        //Did what you wanted to do
        complete(true)

        //Cancelled the action
        complete(false)
    }

这让 UI 更新并删除尾随或前导操作.

This lets the UI update and remove the trailing or leading actions.

这篇关于尾随滑动动作不解除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆