Skip to content

Instantly share code, notes, and snippets.

@shanecowherd
Created November 21, 2019 20:41
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 shanecowherd/2a4b2258e15a350711196dc01c79f7e1 to your computer and use it in GitHub Desktop.
Save shanecowherd/2a4b2258e15a350711196dc01c79f7e1 to your computer and use it in GitHub Desktop.
When you rotate a screen, prevent animations and just snap into place
// When you rotate a screen, prevent animations and just snap into place
override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
coordinator.animate(alongsideTransition: nil) { _ in
UIView.setAnimationsEnabled(true)
}
UIView.setAnimationsEnabled(false)
super.viewWillTransition(to: size, with: coordinator)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment