Skip to content

Instantly share code, notes, and snippets.

@e23z
Created July 26, 2017 15:58
Show Gist options
  • Save e23z/886ecec03ca4d7e92c04b6fc525304b6 to your computer and use it in GitHub Desktop.
Save e23z/886ecec03ca4d7e92c04b6fc525304b6 to your computer and use it in GitHub Desktop.
[Animated UITableView Reload] How to animate an UITableView when it reloads its data. #ios #swift #animation #ui
UIView.transitionWithView(tableView,
duration: 0.35,
options: .TransitionCrossDissolve,
animations: { () -> Void in
self.tableView.reloadData()
},
completion: nil);
/*
possible animations:
.TransitionNone
.TransitionFlipFromLeft
.TransitionFlipFromRight
.TransitionCurlUp
.TransitionCurlDown
.TransitionCrossDissolve
.TransitionFlipFromTop
.TransitionFlipFromBottom
*/
// another alternative should be reloading the sections
// [_tableView reloadSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationFade];
@rungxanh1995
Copy link

Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment