mkto mkto - 1 year ago 124
Objective-C Question

I do not want animation in the begin updates, end updates block for uitableview?

I have a UITableView.
It is using a custom table cell and each cell has a uiwebview.
Bcoz UIWebView took along time to load, i want to avoid reloading them at all cost.
In some situations, I have all cells loaded, but their heights are messed up.
Therefore, I need to "relayout" the table without triggering the "cellForRow" function.

  1. I definitely cannot use reloadData... as it will reload the cells again.

  2. I tried tableView.setNeedDisplay, setNeedsLayout etc, none of them is able to rearrange the table cells

  3. The only way it worked, is to call beginupdates/endupdates block, this block is able to relayout my table without firing cellForRow! BUT, I didnt want the animation! This block produces an animation effect but i do not want it...

How can I solve my problem?

Answer Source
[UIView setAnimationsEnabled:NO];
[tableView beginUpdates];
[tableView endUpdates];
[UIView setAnimationsEnabled:YES];
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download