iOS13/iPadOS13 modal view controller automatic swipe to dismiss break view that captures touch

360 Views Asked by At

I found this thread but it doesn't reflect my situation: Disable gesture to pull down form/page sheet modal presentation

I have this problem: My app opens a small view controller via modal presentation in formsheet format. A navigationcontroller is presented which contains a static tableviewcontroller, inside the only cell I have a view that captures a signature via "touchesBegan" and "touchesMoved".

Screenshot

When I try to draw the signature the touch is captured by the view controller which tries to dismiss itself.

Obviously I have activated the property "modalInPresentation"

How do I find the gestureRecognizer responsible for this?

self.view.gestureRecognizers He gives me these back, but nobody seems to intercept the gesture of dismiss:

<UIScrollViewDelayedTouchesBeganGestureRecognizer: 0x280ac8800; state = Possible; enabled = NO; delaysTouchesBegan = YES; view = <UITableView 0x10711a000>; target= <(action=delayed:, target=<UITableView 0x10711a000>)>>
<UIScrollViewPanGestureRecognizer: 0x105bfe170; state = Possible; enabled = NO; delaysTouchesEnded = NO; view = <UITableView 0x10711a000>; target= <(action=handlePan:, target=<UITableView 0x10711a000>)>>
<UIScrollViewKnobLongPressGestureRecognizer: 0x105b9b270; state = Possible; view = <UITableView 0x10711a000>; target= <(action=_handleKnobLongPressGesture:, target=<UITableView 0x10711a000>)>; numberOfTapsRequired = 0; minimumPressDuration = 0.1>
<UIScrollViewKnobLongPressGestureRecognizer: 0x105b9b440; state = Possible; view = <UITableView 0x10711a000>; target= <(action=_handleKnobLongPressGesture:, target=<UITableView 0x10711a000>)>; numberOfTapsRequired = 0>
<UIHoverGestureRecognizer: 0x112fb7f60; state = Possible; view = <UITableView 0x10711a000>; target= <(action=_handleKnobHoverGesture:, target=<UITableView 0x10711a000>)>>
<_UIDragAutoScrollGestureRecognizer: 0x28098ec10; state = Possible; cancelsTouchesInView = NO; delaysTouchesEnded = NO; view = <UITableView 0x10711a000>; target= <(action=_handleAutoScroll:, target=<UITableView 0x10711a000>)>>
<_UISwipeActionPanGestureRecognizer: 0x105be9d00; state = Possible; view = <UITableView 0x10711a000>; target= <(action=_swipeRecognizerDidRecognize:, target=<_UISwipeHandler 0x281896b00>)>>
<_UISwipeDismissalGestureRecognizer: 0x280ac8d00; state = Possible; enabled = NO; delaysTouchesBegan = YES; view = <UITableView 0x10711a000>; target= <(action=_dismissalRecognizerDidRecognize:, target=<_UISwipeHandler 0x281896b00>)>>
3

There are 3 best solutions below

0
On BEST ANSWER
0
On

Should be this

<UIDropShadowView: 0x10521faf0; frame = (0 40; 375 627); gestureRecognizers = <NSArray: 0x2803a5f50>; layer = <CALayer: 0x280de8e00>>
(lldb) po [self.view _parentDescription]
<UIView: 0x10521dac0; frame = (0 0; 375 627); autoresize = W+H; gestureRecognizers = <NSArray: 0x2803a5bc0>; layer = <CALayer: 0x280de87c0>>
    <UIView: 0x105220880; frame = (0 0; 375 627); clipsToBounds = YES; autoresize = W+H; layer = <CALayer: 0x280de8d40>>
        <UIView: 0x105220380; frame = (0 0; 375 627); clipsToBounds = YES; autoresize = W+H; layer = <CALayer: 0x280de8d60>>
            <UIDropShadowView: 0x10521faf0; frame = (0 40; 375 627); gestureRecognizers = <NSArray: 0x2803a5f50>; layer = <CALayer: 0x280de8e00>>
                <UITransitionView: 0x10521f540; frame = (0 0; 375 667); autoresize = W+H; layer = <CALayer: 0x280de8d20>>
                    <UIWindow: 0x105106ac0; frame = (0 0; 375 667); autoresize = W+H; gestureRecognizers = <NSArray: 0x2803ad230>; layer = <UIWindowLayer: 0x280ded800>>
0
On

If you are using pushViewController then you need to present this popviewController. Like this.

let vc = storyboard?.instantiateViewController(withIdentifier: "popSignatureViewController") as? popSignatureViewController
        vc?.modalPresentationStyle = .overCurrentContext
        self.present(vc!, animated: true, completion: nil)