0

I have a UITableView, for which I am reloading each row with new data by using:

for currentIndex in (feeds.count-1).stride(through: 0, by: -1) {
    self.feedList[currentIndex] = feeds[currentIndex]

    dispatch_async(dispatch_get_main_queue()) {
        self.tableView.beginUpdates()

        self.tableView.reloadRowsAtIndexPaths([NSIndexPath(forRow: currentIndex, inSection: 0)], withRowAnimation: UITableViewRowAnimation.Middle)
        self.tableView.endUpdates()
    }
}

This makes all the rows animate together at once. What I want is for each row to animate one after the other. How can I achieve this?

Alexander Perechnev
  • 2,797
  • 3
  • 21
  • 35
PhoenixDev
  • 746
  • 2
  • 9
  • 22
  • Have you tried to use CATransaction and animate only one row at a time, and call the animation for the next row in CATransaction's completion block? – Dennis Pashkov Jan 15 '16 at 08:56

1 Answers1

2

The commentor is correct about CATransaction. Here's an example of how to combine what you have with CATransaction to get the proper animation sequence. Save the stride that you want to animate, and iterate one more element through until you've animated them all.

Community
  • 1
  • 1
tbondwilkinson
  • 1,067
  • 2
  • 8
  • 16