How do I set up an UIScreenEdgePanGestureRecognizer using Interface Builder?

后端 未结 7 1419
自闭症患者
自闭症患者 2021-02-06 23:48

I can\'t get UIScreenEdgePanGestureRecognizer to work when I create when I add it to my view controller using Interface Builder, so I\'m asking here to establish wh

7条回答
  •  星月不相逢
    2021-02-07 00:35

    To make sure that multiple gesture recognizers can work together you have to implement the method shouldRecognizeSimultaneouslyWithGestureRecognizer and return true:

    func gestureRecognizer(gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWithGestureRecognizer otherGestureRecognizer: UIGestureRecognizer) -> Bool {
        return true
    }
    

    Sorry for the Swift code but you should get the idea.

    This method must be implemented even if you are using a single gesture recognizer because the view can have its own (system) recognizers, such as MKMapView.

提交回复
热议问题