简体   繁体   English

重新加载表时关闭UISwipeActionsConfiguration

[英]Dismiss UISwipeActionsConfiguration on reloading the table

When user swipe the cell I m showing some option. 当用户滑动单元格时,我正在显示一些选项。 Everything is working fine, When user scroll the table swipe option goes off. 一切正常,当用户滚动时,表格滑动选项关闭。 I want the same behaviour when I reload the table on data change. 在数据更改时重新加载表时,我想要相同的行为。 How to achieve that. 如何实现。 If user has swipe the cell and I reload table , Swipe options are still there. 如果用户已滑动单元格并重新加载表格,则“滑动”选项仍然存在。

You hide the swiped cell just add this line of code before reloading the table view. 您可以隐藏滑动的单元格,只需在重新加载表格视图之前添加此行代码即可。

tableView.setEditing(false, animated: true)

Now for enabling the editing, In your cellForAtIndex Path function make a check like 现在启用编辑功能,在cellForAtIndex Path函数中进行如下检查

if indexPath.row == array.size {
   tableView.setEditing(true, animated: true)
}

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM