更改UITableView动画的持续时间(使用表beginUpdates插入/删除行) [英] Change duration of UITableView animation (Insert/Delete rows with table beginUpdates)

查看:142
本文介绍了更改UITableView动画的持续时间(使用表beginUpdates插入/删除行)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以更改 [表beginUpdates] / [表endUpdates] 动画的持续时间?

Is there a way to change the duration of [table beginUpdates]/[table endUpdates] animations?

这是我尝试过的,没有运气:

This is what I've tried, with no luck:

选择1:

[UIView animateWithDuration:5.0 delay:0.0 options:(UIViewAnimationOptionCurveEaseInOut|UIViewAnimationOptionOverrideInheritedDuration) animations:^{

     [self.tableView beginUpdates];

     [self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithArray:indexPaths] withRowAnimation:UITableViewRowAnimationTop];

     [self.tableView endUpdates];


} completion:^(BOOL finished) {
}];

选项2:

[CATransaction begin];

[CATransaction setCompletionBlock:^{
    NSLog(@"I actually get called!");
}];

[CATransaction setAnimationDuration:5.0]; //but I don't work

[self.tableView beginUpdates];

[self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithArray:indexPaths] withRowAnimation:UITableViewRowAnimationTop];

[self.tableView endUpdates];

[CATransaction commit];


推荐答案

为什么不尝试UIView动画。

Why don't you try UIView animation.

[UIView animateWithDuration:2 delay:0.2 options:UIViewAnimationOptionCurveEaseInEaseOut animations:^{
  [self.tableView beginUpdates];
  [self.tableView endUpdates];
} completion:^(BOOL finished) {
  // code
}];

这篇关于更改UITableView动画的持续时间(使用表beginUpdates插入/删除行)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆