Bug in UITableView ( deleteSections:withRowAnimation: )?

Viewed 4847

I have problems using this UITableView method:

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

First the documentation says:

animation: YES to animate the deletion of sections, otherwise NO.

But the parameter animation is actually of type enum UITableViewRowAnimation, not BOOL!?

So how can I disable the animation? I've tried NO and UITableViewRowAnimationNone. Nothing works. The section deletion is always animated.

I know that I can use [tableView reloadData] instead. That would solve my issue. I'm just curious if that is a known problem and if it is possible to disable animation with this tableview method.

Thanks!

4 Answers

I believe you need to embed the deleteSections call inside a beginUpdates block:

[tableView beginUpdates];
[tableView deleteSections:... withRowAnimation:... ];
[tableView endUpdates];

The documentation seems to say this anyway. I haven't tested this with UITableRowViewAnimationNone though.

Related