I've got a grouped UITableView with a couple of rows, and I'm animating a few more rows in and out on the toggle of a button. The problem is that with any of the row animation types I'm using (top & bottom) the animation looks horrible! Here's a screenshot mid-animation:
(source: michaelwaterfall.com)
Is there a reason why it's looking so bad? Or do all grouped table view animations look this shocking!?
I think it only looks so bad when the first or last row in a section is being animated, so I'm just wondering if there's any way to get it looking a bit better!? Otherwise I think I'll just call reloadData and have it all just appear.
Thanks for your help!
Michael
If you remove, add and/or move several rows in a UITableView
at the same time, then you must enclose all these calls with beginUpdates
and endUpdates
. Otherwise the result is undetermined.
For example:
[tableView beginUpdates];
[tableView insertRowsAtIndexPaths:newRows
withAnimation:UITableViewRowAnimationTop];
[tableView deleteRowsAtIndexPaths:invalidRows:
withAnimation:UITableViewRowAnimationTop];
[tableView endUpdates];
I am not sure exactly what looks bad. It is hard to tell from a static picture.
Unfortunately you have no control over the insertion/deletion animation in a tableviews. It is all handled by the high level UITableView API.
The only other option is to perform the animations separately and consecutively and see if that looks any better. I've done this to eliminate some artifacts.
Also try different animations like the fade in/out. Not as flashy, but looks better in some situations.
I've used animations in a grouped table view without any problem, and it always looked great. How about sharing some of the code? Maybe you're doing something wrong in the cell building... or although unlikely in the insertion of the rows.
As others have said, posting some code would help.
Are you already performing your multiple inserts/deletes inside of a beginUpdates/endUpdates block?
For future reference, please see #6931544. I've found these arbitrary lines mid transition can be removed with the following: -
[self.tableView setSeparatorStyle:UITableViewCellSelectionStyleNone];