Reputation: 4271
I am currently inserting cells in my UITableView
with the following code:
[rottenTableView insertRowsAtIndexPaths:indexPathsToInsert withRowAnimation:UITableViewRowAnimationTop];
It does the job correctly with the animation UITableViewRowAnimationTop
. However, I would like to insert the cells with 2 animations at the same time (UITableViewRowAnimationTop
and UITableViewRowAnimationFade
). I tried the following:
[rottenTableView insertRowsAtIndexPaths:indexPathsToInsert withRowAnimation:(UITableViewRowAnimationTop|UITableViewRowAnimationFade)];
This code does not seem to animate insertion any differently than before. Any way to perform both animations?
Upvotes: 0
Views: 974
Reputation: 6032
As far as I know, when you use -insertRowsAtIndexPaths:withRowAnimation:
there could be only one animation type for a single cell simultaneously. But I could suggest using different animation types for different cells at the same time. For this you can use batch UITableView cell's updation via using beginUpdates
/endUpdates
. All the animations will fire at the same time, you can use it like this:
[tableView beginUpdates];
[tableView insertRowsAtIndexPaths:insertIndexPaths1 withRowAnimation:UITableViewRowAnimationRight];
[tableView insertRowsAtIndexPaths:insertIndexPaths2 withRowAnimation:UITableViewRowAnimationOTHER];
[tableView endUpdates];
For details check this: Batch Insertion, Deletion, and Reloading of Rows and Sections.
Also check this question about custom insertion animations: Can you do custom animations for UITableView Cell Inserts?
Upvotes: 3