为表中新添加的行设置动画

时间:2012-06-14 09:55:30

标签: iphone objective-c ios xcode cocoa

是否可以让IndexPath当前在表中插入新行。表数据通过Core Data加载。数据按部分排序。 我想在表格中添加一个新的动画,如下图所示。

http://i45.tinypic.com/2ykjj7n.png

3 个答案:

答案 0 :(得分:2)

您可以使用以下方法:

NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0];

[self.tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];

代码经过测试,肯定会对你有用......

答案 1 :(得分:0)

这个怎么样?这是你想要收集的吗?我不确定。

[yourTableView beginUpdates];
[yourTableView moveRowAtIndex:firstStateIndex toIndex:endStateIndex];
[yourTableView endUpdates];

当然,您必须首先插入特定行,以便之后可以移动它。动画可能就是这样。

答案 2 :(得分:0)

[tblMainView beginUpdates];
[tblMainView reloadRowsAtIndexPaths:<#(NSArray *)#> withRowAnimation:UITableViewRowAnimationLeft];
[tblMainView endUpdates];