UIPanGestureRecognizer sometimes not working on iOS 7

后端 未结 2 389
甜味超标
甜味超标 2020-12-28 11:16

I\'m getting intermittent reports from users on iOS 7 saying that the UIPanGestureRecognizer stops working on certain views every once in a while. They\'re supp

2条回答
  •  暖寄归人
    2020-12-28 12:03

    I think I finally solved this issue. Apparently iOS 7 handles gestures in subviews differently than it did in iOS 6 and earlier. To handle this, Apple implemented a new delegate:

    (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldBeRequiredToFailByGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
    

    If you return YES, that should get your gesture recognizer to work. I've implemented it and haven't had any issues so far (though admittedly this was a rare bug that I could never reliably reproduce, so it's possible that it just hasn't recurred yet).

    For more information, see https://stackoverflow.com/a/19892166/1593765.

提交回复
热议问题