在UITableViewCell中,如何将删除确认模式恢复为正常编辑模式? [英] In UITableViewCell how can I revert the delete confirmation mode back to normal editing mode?

查看:56
本文介绍了在UITableViewCell中,如何将删除确认模式恢复为正常编辑模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在某些单元格的常规单元格删除确认上方,我有一个自定义确认警报对话框,它对这些单元格进行了两次确认. (这是在用户进入编辑模式后,而不是通过滑动).因此,如果用户单击确定"以在我的自定义确认对话框中进行确认.它应该进行实际的删除,因为从TableView中删除了整个单元格,因此表现良好.但是,如果用户单击取消",则该单元格不会被删除,它将保留在表中并保持在取消确认模式".这不是我想要的,我希望它恢复为常规单元格编辑模式".我在Apple文档中进行了搜索,它仅提供"showingDeleteConfirmation"只读方法.将此模式恢复为单元格编辑.我可以这样做:

I have a custom confirmation alert dialog box on top of the regular cell deletion confirmation for some cells, it's sort of doing a double confirmation for these cells. (This is after user enters editing mode, not by swipe) So, if the user clicks 'OK' to confirm in my custom confirmation dialog. It's supposed to do the actual deletion, which behaves well since the whole cell will be removed from the TableView. However, if the user clicks 'Cancel' The cell does not get deleted it remains in the table and remain in "Cancellation Confirmation Mode". This is not what I want, I want it to be reverted back to the 'Normal cell editing mode". I've searched through apple documentation, it only provides a "showingDeleteConfirmation" readonly method. It doesn't really have a way to revert this mode back to cell editing. I can do this to hack it:

        [cell setEditing:NO animated:NO];
        [cell setEditing:YES animated:NO];

我无法在此处启用动画,因为它看起来很糟,它正试图再次从非编辑模式返回到编辑模式.但是,如果没有动画过渡,动画过渡就不会很顺利.有没有更清洁的方法可以做到这一点?

I can't enable animation here because it will look bad it's temping to go back to non-editing mode to editing mode again. But the animation transition is not quite smooth without it. IS THERE ANY CLEANER WAY TO DO THIS?

推荐答案

对于仍在寻找它的其他人,这对单个单元格进行了平滑,相反的过渡:

for anyone else still looking for this, this does a smooth, opposite transition for a single cell:

[tableView setEditing:FALSE animated:TRUE];

这篇关于在UITableViewCell中,如何将删除确认模式恢复为正常编辑模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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