UITableViewRowAnimation作为块(而不是行)动画

时间:2011-12-01 05:39:50

标签: objective-c ios uitableview xamarin.ios

是否有同时制作UITableViewRowAnimation动画?

例如,如果我向TableView添加4行,请为4行的块设置动画,而不是单独为这两行设置动画?

Snippet,自定义动画教程等欢迎!

1 个答案:

答案 0 :(得分:0)

有几种方式as described in the docs

  

行和节的批量插入,删除和重新加载

     

UITableView类允许您插入,删除和重新加载组   一次行或部分,动画操作   同时以特定的方式。清单中显示了八种方法   7-7涉及批量插入和删除。请注意,你可以打电话   这些插入和删除方法在动画块之外(如   你在数据源方法中做   tableView:commitEditingStyle:forRowAtIndexPath:如中讨论的   “在编辑模式下插入和删除行”。

     

清单7-7批量插入和删除方法

- (void)beginUpdates;
- (void)endUpdates;

- (void)insertSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation;
- (void)deleteSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation;
- (void)reloadSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation;

- (void)insertRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation: (UITableViewRowAnimation)animation;
- (void)deleteRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation: (UITableViewRowAnimation)animation;
- (void)reloadRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation;