Skip to content

Instantly share code, notes, and snippets.

@maxcampolo
Created June 20, 2016 12:44
Show Gist options
  • Save maxcampolo/d35f0657570a553a64b4c78a45214bb4 to your computer and use it in GitHub Desktop.
Save maxcampolo/d35f0657570a553a64b4c78a45214bb4 to your computer and use it in GitHub Desktop.
public override func viewWillTransitionToSize(size: CGSize, withTransitionCoordinator coordinator: UIViewControllerTransitionCoordinator) {
super.viewWillTransitionToSize(size, withTransitionCoordinator: coordinator)
// Before rotation (willTransitionToInterfaceOrientation)
// ... Do stuff that should happen before rotation ... //
coordinator.animateAlongsideTransition({ (context) in
// During rotation
// ... Do stuff that should happen during rotation ... //
},
completion: { (context) in
// After rotation (didTransitionToInterfaceOrientation)
// ... Do stuff that should happen after rotation ... //
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment