Skip to content

Instantly share code, notes, and snippets.

@xilin
Last active May 9, 2017 02:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xilin/9e9797b30cd3fb38e031104567c97966 to your computer and use it in GitHub Desktop.
Save xilin/9e9797b30cd3fb38e031104567c97966 to your computer and use it in GitHub Desktop.
Reload table with a snapshot transition
// From https://github.com/facebookarchive/AsyncDisplayKit/issues/616#issuecomment-133422166
- (void)reloadData
{
UIView *snapshot = [_tableView snapshotViewAfterScreenUpdates:NO];
[self.view insertSubview:snapshot aboveSubview:_tableView];
[_tableView beginUpdates];
[_tableView reloadData];
[_tableView endUpdatesAnimated:NO completion:^(BOOL completed) {
[UIView animateWithDuration:1 animations:^{
snapshot.alpha = 0;
} completion:^(BOOL finished) {
[snapshot removeFromSuperview];
}];
}];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment