【发布时间】:2012-06-14 09:55:30
【问题描述】:
是否可以让 IndexPath 当前将新行插入表中。表数据通过核心数据加载。数据按部分排序。 我想在表格中添加一个新行以进行动画处理,如下图链接所示。
【问题讨论】:
-
从顶部一路动画不包括在苹果的默认表格动画中。
标签: iphone objective-c ios xcode cocoa
是否可以让 IndexPath 当前将新行插入表中。表数据通过核心数据加载。数据按部分排序。 我想在表格中添加一个新行以进行动画处理,如下图链接所示。
【问题讨论】:
标签: iphone objective-c ios xcode cocoa
您可以使用以下方法:
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0];
[self.tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
代码已经过测试,肯定会为您工作...
【讨论】:
这个呢?这是你要收集的吗?我不确定。
[yourTableView beginUpdates];
[yourTableView moveRowAtIndex:firstStateIndex toIndex:endStateIndex];
[yourTableView endUpdates];
当然,您必须首先插入特定行,以便以后移动它。动画可能会这样发生。
【讨论】:
[tblMainView beginUpdates];
[tblMainView reloadRowsAtIndexPaths:<#(NSArray *)#> withRowAnimation:UITableViewRowAnimationLeft];
[tblMainView endUpdates];
【讨论】: