Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bug in UITableView ( deleteSections:withRowAnimation: )?

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!

like image 350
Felix Avatar asked Jun 21 '11 20:06

Felix


1 Answers

It's kind of a hack but this gets rid of the insert animation:

[UIView setAnimationsEnabled:NO];
[self.tableView insertRowsAtIndexPaths:insertedIndexPaths withRowAnimation:UITableViewRowAnimationNone];
[UIView setAnimationsEnabled:YES];
like image 163
samvermette Avatar answered Oct 11 '22 20:10

samvermette