Skip to content

Instantly share code, notes, and snippets.

@JoelJWest
Created June 16, 2016 19:57
Show Gist options
  • Save JoelJWest/577d1b87ffc857d63e938d8cbf310df9 to your computer and use it in GitHub Desktop.
Save JoelJWest/577d1b87ffc857d63e938d8cbf310df9 to your computer and use it in GitHub Desktop.
- (void)viewWillTransitionToSize:(CGSize)size
withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
{
// dont show that the page is incorrect breifly during transition
NSUInteger currentAccountIndex = self.currentAccountIndex;
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
[coordinator animateAlongsideTransition:nil
completion:^ (id<UIViewControllerTransitionCoordinatorContext> context) {
self.currentAccountIndex = currentAccountIndex;
self.accountsCollectionView.contentOffset = CGPointMake(self.accountsCollectionView.width * currentAccountIndex, 0.f);
}];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment