Closed chaiyixiao closed 8 years ago
Hi @chaiyixiao,
My understanding of the issue is that after setting .OverCurrentContext
, the presenting view controller disappears and you get a black screen after you dismiss the modal. Is this correct?
I created a new branch that hopefully fixes the issue: https://github.com/ThornTechPublic/InteractiveModal/tree/chaiyixiao
.OverFullScreen
and .OverCurrentContext
are certainly useful when making semi-transparent modals. And definesPresentationContext
is useful in making sure the presenting VC stays on-screen.
But I think as soon as we take control of the transitioning animation, it's difficult to merge our custom implementation with whatever magic Apple is doing with each modal presentation style.
I was able to get the semi-transparent modal effect by doing the following:
animationControllerForPresentedController
The PresentAnimator does the following:
The key step is creating a snapshot of the fromVC. By default, the fromVC is removed at the end of a transition. But the snapshot gives the illusion that it's still there.
Note: I did not use .OverCurrentContext
nor definesPresentationContext
. I'm sure there's probably a better solution that leverages the use of .OverCurrentContext
, but I don't know enough about what's going on behind the scenes to figure it out.
Hi @chenr2,
Thank you so much for your reply. Your way is simple and works perfectly. I was trying to hold the presentingView
in AnimationController during dismissal, but the code got ugly :(
Thanks again : ]
I was trying to implement a transparent modal in my project referencing to your tutorial(Thanks for sharing: ] ), as it's doesn't cover full screen, In addition to
destinationViewController.transitioningDelegate = self
destinationViewController.interactor = interaction
, I need to addself.definesPresentationContext = true
(<- Important)destinationViewController.modalPresentationStyle = .OverCurrentContext
inprepareForSegue
for presentingViewController. However, then problem happened that transitioning delegate ( not to say interactor). I tried to search online, but still couldn't get a clue. Do you have any idea what might help?Many thanks! Yixiao