UITableview reloaddata with animation
To add to the correct answer, if you want to reload all sections in your UITableView
you will need to do the following:
ObjC
NSRange range = NSMakeRange(0, [self numberOfSectionsInTableView:self.tableView]);NSIndexSet *sections = [NSIndexSet indexSetWithIndexesInRange:range];[self.tableView reloadSections:sections withRowAnimation:UITableViewRowAnimationAutomatic];
Swift
let range = NSMakeRange(0, self.tableView.numberOfSections) let sections = NSIndexSet(indexesIn: range) self.tableView.reloadSections(sections as IndexSet, with: .automatic)
This will reload everything in the table view with an animation. Like a boss.
Swift 5:
UIView.transition(with: tableView, duration: 1.0, options: .transitionCrossDissolve, animations: {self.tableView.reloadData()}, completion: nil)
Swift 3
UIView.transition(with: myTableView, duration: 1.0, options: .transitionCrossDissolve, animations: {self.myTableView.reloadData()}, completion: nil)
Swift 2
UIView.transitionWithView(myTableView, duration: 1.0, options: .TransitionCrossDissolve, animations: {self.myTableView.reloadData()}, completion: nil)
I went with this in Swift
use this method,
[_tableView reloadSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationFade];