How to debug who is eating my touches in UIKit?

前端 未结 7 1495
孤街浪徒
孤街浪徒 2021-01-30 17:16

I can\'t figure out why tapping on text fields and buttons in my view is not working. I\'ve checked all the obvious things like whether userInteractionEnabled is set to YES, whe

7条回答
  •  梦毁少年i
    2021-01-30 17:46

    To see more detail about which kind of gesture recognizers is source of issue from @Peter's answer, I print out the array of gestureRecognizer:

    class TestWindow:UIWindow {
        override func sendEvent(_ event: UIEvent) {
    
            event.allTouches?.forEach() { touch in
                print("touch")
                print(touch.gestureRecognizers ?? "")
                /// [; target= <(action=_handleMenuGesture: ....
            }
    
            super.sendEvent(event)
        }
    }
    
    

提交回复
热议问题