Closed sfla closed 4 years ago
Hi @sfla, the overlay container CV will use the OverlayAnimatedTransitioning
provided by its delegate to animate a translation (ref). You can provide your own object to modify the animation. Implement:
func overlayContainerViewController(_ containerViewController: OverlayContainerViewController,
transitioningDelegateForOverlay overlayViewController: UIViewController) -> OverlayTransitioningDelegate?
Note that by default the container uses the SpringOverlayTranslationAnimationController
which uses this UISpringTimingParameters
init under the hood. So, the animation is entirely based on physics, the duration parameter is actually 0.
See this to animate things alongside the overlay translation.
Great! Thanks. I haven't used (animateAlongside:) with transitionCoordinator and context etc. that much in the past, so I'll look into it. The challenge is that I want it the other way around; to make the overlay animate alongside another animation.
You can try to move the overlay without animation and call layoutIfNeeded
on any view that contains it (or on its view if it's already the root view) . Something like:
UIView.animate(withDuration: 1) {
self.overlayContainer.moveOverlay(toNotchAt: 0, animated: false)
self.view.layoutIfNeeded()
}
It should override all the internal animation behavior.
Oh man. I tried that yesterday, but didn't include the layoutIfNeeded()
, Thanks!
Thank you! :) This has saved my day :)! BTW @gaetanzanella this library is really really awesome! Thank you for putting so much effort on it and let the others use it :)
This is more of a request for help than an issue, I guess, but I can't figure out how to set the duration of the animation when calling
moveOverlay(toNotchAt:,animated:)
. I even considered importing the entire OverlayContainer as classes instead of a pod so I could manipulate it if it was private, but I can't find a duration anywhere, just velocity and advanced animation protocols. It would be nice to make it animate alongside another animation too, but I just don't understand how. The ShowOverlayExample just uses the basic "moveOverlay" with the default duration, so it couldn't help me..