问题
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