添加/删除带有动画的 UITableViewCell? [英] Add/Delete UITableViewCell with animation?
本文介绍了添加/删除带有动画的 UITableViewCell?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我知道这可能听起来像一个愚蠢的问题,但我到处都看过.我该怎么做?
I know this might sound like a dumb question, but I have looked every where. How can I do this?
我知道如何使用 swype-to-delete 方法执行此操作,但我如何在该函数之外执行此操作?
I know how to do this with a swype-to-delete method, but how cam I do it outside that function?
请发布一些代码示例.
谢谢!
库尔顿
推荐答案
[self.tableView beginUpdates];
[self.tableView insertRowsAtIndexPaths:insertIndexPaths withRowAnimation:UITableViewRowAnimationFade];
[self.tableView deleteRowsAtIndexPaths:deleteIndexPaths withRowAnimation:UITableViewRowAnimationFade];
[self.tableView endUpdates];
insertIndexPaths
是要插入到表中的 NSIndexPaths 数组.
insertIndexPaths
is an array of NSIndexPaths to be inserted to your table.
deleteIndexPaths
是要从表中删除的 NSIndexPaths 数组.
deleteIndexPaths
is a array of NSIndexPaths to be deleted from your table.
索引路径的示例数组格式:
Example array format for index paths :
NSArray *insertIndexPaths = [[NSArray alloc] initWithObjects:
[NSIndexPath indexPathForRow:0 inSection:0],
[NSIndexPath indexPathForRow:1 inSection:0],
[NSIndexPath indexPathForRow:2 inSection:0],
nil];
这篇关于添加/删除带有动画的 UITableViewCell?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文