iOS 13 UIPanGestureRecognizer behave differently from iOS 12

a 夏天 提交于 2020-06-26 08:46:43

问题


I have a custom scroll view that works well before iOS 13 that uses UIPanGestureRecognizer:

    _panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePan:)];
    _panRecognizer.delegate = self;

- (void)handlePan:(UIGestureRecognizer *)gestureRecognizer
{
    UIPanGestureRecognizer* pgr = (UIPanGestureRecognizer*)gestureRecognizer;
    if (pgr.state == UIGestureRecognizerStateChanged) {
        // do something
    }
}

Now it didn't work well with iOS 13. The handlePan function does not get called anymore until 3 fingers are panning together. In iOS 12, this function will be called when just 1 finger is moved.

I have tried setting the min/maximumNumberOfTouches but not working. Is there anything changed?


回答1:


It sounds like your gesture is now competing with a system gesture. Did you check the .gestureRecognizers property of the view to see if something changed?

You might have to implement gestureRecognizer(_:shouldRecognizeSimultaneouslyWith:) delegate method, by default it returns false.



来源:https://stackoverflow.com/questions/56918410/ios-13-uipangesturerecognizer-behave-differently-from-ios-12

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!