【问题标题】:Animate the newly added row in the table为表格中新添加的行设置动画
【发布时间】:2012-06-14 09:55:30
【问题描述】:

是否可以让 IndexPath 当前将新行插入表中。表数据通过核心数据加载。数据按部分排序。 我想在表格中添加一个新行以进行动画处理,如下图链接所示。

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

【问题讨论】:

  • 从顶部一路动画不包括在苹果的默认表格动画中。

标签: iphone objective-c ios xcode cocoa


【解决方案1】:

您可以使用以下方法:

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

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

代码已经过测试,肯定会为您工作...

【讨论】:

    【解决方案2】:

    这个呢?这是你要收集的吗?我不确定。

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

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

    【讨论】:

      【解决方案3】:
      [tblMainView beginUpdates];
      [tblMainView reloadRowsAtIndexPaths:<#(NSArray *)#> withRowAnimation:UITableViewRowAnimationLeft];
      [tblMainView endUpdates];
      

      【讨论】:

      • reloadRowsAtIndexPaths: 之后的那个位是什么意思?
      猜你喜欢
      • 2014-05-20
      • 2015-10-16
      • 2015-10-09
      • 1970-01-01
      • 2023-04-08
      • 2015-08-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多