Skip to content

Instantly share code, notes, and snippets.

@yusuke024
Last active July 27, 2018 07:14
Show Gist options
  • Save yusuke024/e43216f4d47746279980c0a000f95854 to your computer and use it in GitHub Desktop.
Save yusuke024/e43216f4d47746279980c0a000f95854 to your computer and use it in GitHub Desktop.
Note on UIKit

Note on UIViewControllerAnimatedTransitioning and UIViewControllerInteractiveTransitioning

UINavigationController

  • Do not pass true to UIView.snapshotView(afterScreenUpdates:) when create a snapshot for animated transition object (false is fine).
  • Don't call animator.startAnimation() or animator.pauseAnimator() in startInteractiveTransition(_:)
  • If interruptibleAnimator(using:) is implemented, UINavigationController will observe fractionComplete from the returned animator object (not confirmed but very likely) and will animate the navigation bar accordingly to that value. Calling UIViewControllerContextTransitioning.updateInteractiveTransition(_:) will almost have no effect on the navigation bar animation (but you should call it anyway).
  • If interruptibleAnimator(using:) is not implemented, UINavigationController will use values that are passed to UIViewControllerContextTransitioning.updateInteractiveTransition(_:) to animate the navigation bar.

UINavigationBar

  • You cannot set the height of UINavigationBar to something other than 44. UINavigationBar will kindly set the height of itself back. Of course you can force this after viewDidLayoutSubviews for example, but you'll get jumpy transition animation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment