UISystemGateGestureRecognizer and delayed taps near bottom of screen

后端 未结 2 1895
攒了一身酷
攒了一身酷 2020-12-15 20:25

What are the standard UISystemGestureGateGestureRecognizers installed on the top level UIView of an iOS app for?

My app consists of two vie

相关标签:
2条回答
  • 2020-12-15 21:01

    This delayed touches bothered me too. Just as an addition to what's said before, here's a simple fix:

    override func viewDidAppear(_ animated: Bool) {
        let window = view.window!
        let gr0 = window.gestureRecognizers![0] as UIGestureRecognizer
        let gr1 = window.gestureRecognizers![1] as UIGestureRecognizer
        gr0.delaysTouchesBegan = false
        gr1.delaysTouchesBegan = false
    }
    

    no need to remove those gesture recognizers. just add this to the main view controller.

    0 讨论(0)
  • 2020-12-15 21:22

    It appears that these recognizers are meant to prevent accidental touches near the top and bottom of the screen. They aren't configured with any targets, but can (like any UIResponder) absorb touches to prevent them from being passed up the responder chain.

    Notes (tested on iOS 7.1):

    • Both gesture recognizers are always present in the key window.
    • I inspected both gestures' _targets ivar, and found they aren't configured with any targets at all. Swizzled out addTarget:action: to verify that targets weren't being added or removed on the fly.
    • delegate is always nil for both instances.
    • If you disable the gesture recognizers, they will re-enable themselves
    • The gesture that that doesn't delay content touches fires when you drag up from the bottom or drag down from the top. I couldn't trigger the instance that delays touches.
    0 讨论(0)
提交回复
热议问题