iOS13/iPadOS13 模态视图控制器自动滑动以关闭捕获触摸的中断视图

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

我找到了这个帖子,但它没有反映我的情况:

我有这个问题:我的应用程序通过表单格式的模态显示打开一个小视图控制器。呈现了一个包含静态 tableviewcontroller 的导航控制器,在唯一的单元格中,我有一个通过 "touchesBegan" 和 "touchesMoved".

捕获签名的视图

当我尝试绘制签名时,触摸被试图关闭自身的视图控制器捕获。

显然我已经激活了 属性 "modalInPresentation"

如何找到负责此操作的 gestureRecognizer?

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>)>>

如果您使用的是pushViewController,那么您需要呈现这个popviewController。 像这样。

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

应该是这个

<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>>

我使用researchkit 签名解决了它。 https://github.com/ResearchKit/ResearchKit

特别是: https://github.com/ResearchKit/ResearchKit/blob/master/ResearchKit/Common/ORKSignatureView.h