Skip to content

Instantly share code, notes, and snippets.

@0xKayvan
Created November 12, 2015 20:38
Show Gist options
  • Save 0xKayvan/39b6126aba72abbe01cd to your computer and use it in GitHub Desktop.
Save 0xKayvan/39b6126aba72abbe01cd to your computer and use it in GitHub Desktop.
reloadData so the device rotation would be more smooth
-(void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator{
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
[coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context) {
if (size.width > size.height) {
[self.tableView reloadData];
}
} completion:^(id<UIViewControllerTransitionCoordinatorContext> context) {
if (size.width < size.height) {
[self.tableView reloadData];
}
}];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment