在[self.tableView endUpdates]结束后调用方法

Cos*_*min 3 iphone animation uitableview ios5

我想在动画结束后添加我的sliderButton,但这不起作用,它会在删除部分动画时添加按钮.

    [coursesTable beginUpdates];
    [coursesTable deleteSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationTop];
    [coursesTable endUpdates];
    [self.view addSubview:sliderButton];
Run Code Online (Sandbox Code Playgroud)

我有可能在动画结束时调用一个为我做这个的方法吗?

Dav*_*ull 7

我相信包装你的表更新animateWithDuration将工作:

[UIView animateWithDuration:0.0 animations:^{
    [coursesTable beginUpdates];
    …
    [coursesTable endUpdates];
} completion:^(BOOL finished) {
    // Code to run when table updates are complete.
}];
Run Code Online (Sandbox Code Playgroud)

我在Stack Overflow上找到的其他方法对我来说不起作用.

我一次使用这种技术并测试它足以验证在我调用表的endUpdates方法后调用了完成块,但重写了我的代码,所以在我完全验证动画实际上之前我不再需要它了完了.