I have a CustomPresentationController
which animates in and out with custom animations;
This specific controller gets presented, more less at 50% of the screen size, and when I present it, I add a shadow-gray view to the presentingViewController
so it adds some depth.
I can only dismiss the presentedViewController
if I tap the cancel
button in the NavBar
which I call the default dismiss(:)
method.
What I'm trying to accomplish is to detect a tap outside the presentedViewController
, maybe inside the gray zone, so I can dismiss the presentedViewController
, somehow like dismissing an ActionSheet
but I've failed to do it. Let me explain what I've tried so far.
I tried to add a UITapGestureRecognizer
to the shadow-gray view but since I'm presenting a different controller, the app-engine might think that since the shadow view isn't on the top hierarchy view it might not be accessible so it 'blocks' the recognizer - whenever I tap it, the gesture handles doesn't fire.
I'm implementing now in addition a swipe down to dismiss, which I can make it easily, but I really wanted the tap-outside feature to work as well.
Any hint on how can I approach this?
The apps image is the following: