I was wondering if there is any possibility to catch if animation fired during deleteRowsAtIndexPaths did end? What I am trying to do is removing some all rows from UITableView except one that i tapped. Next I want to insert few rows into the same UITableView. Both operations are performed in separates beginUpadate/endUpdate blocks. The problem is that before deleting animation ends, the inserting animation starts and I want it be fired one after another because inserted rows are coming from external webservice.
I was thinking about wrapping inserting and deleting methods (in UITableView subclass) in methods where I could replace standard animation with custom ones and use objective-c blocks to fire one after another when the first ends but it appears to be imposible or I just can't do it.
Thanks in advance for your help!
I believe that wrapping your table update in animateWithDuration
would work:
[UIView animateWithDuration:0.0 animations:^{
[coursesTable beginUpdates];
…
[coursesTable endUpdates];
} completion:^(BOOL finished) {
// Code to run when table updates are complete.
}];
Other methods that I found suggested here on Stack Overflow did not work for me.
I used this technique at one time and tested it enough to verify that the completion block was called after I called the table's endUpdates method and the time that it was called seemed reasonable, but I rewrote my code so I didn't need it any more before I had completely verified that the animation was actually finished.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With