Wrong Frame Starting Center when Translucent is False
alexookah opened this issue · 1 comments
alexookah commented
When using navigation bar with Translucent = False the starting point of the animation is calculated wrong.
Check the following video:
https://streamable.com/gs9rn
Check my forked repo to reproduce:
https://github.com/Alexookah/BubbleTransition
changes:
i added a navigation controller as initial vc and changed the translucency in the navigation Bar.
andreamazz commented
The center is user provided, so you just need to adjust it like this:
func animationController(forPresented presented: UIViewController, presenting: UIViewController, source: UIViewController) -> UIViewControllerAnimatedTransitioning? {
transition.transitionMode = .present
transition.startingPoint = view.convert(transitionButton.center, to: nil)
transition.bubbleColor = transitionButton.backgroundColor!
return transition
}
func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? {
transition.transitionMode = .dismiss
transition.startingPoint = view.convert(transitionButton.center, to: nil)
transition.bubbleColor = transitionButton.backgroundColor!
return transition
}
Notice the call to convert
to get the absolute position.