ios - UIPinchGestureRecognizer on superview does not attempt to recognize pinch when touches are located within different subviews -
i'm trying set pinch gesture on root view in view hierarchy. pinch gesture not recognized if 2 touches make pinch located in 2 different subviews. in following diagram green root view not recognizing pinch gesture (denoted orange touches) because each touch exists in different blue subview. these blue subviews siblings in view hierarchy , children of green root view.
the pinch gesture recognized if both touches occur within same subview. pinch gesture recognizer never changes state, , never gets chance recognize pinch, when touches occur within different subviews (as verified subclassing uipinchgesturerecognizer , logging calls setstate:).
finally, subview's , root view process number of other gestures including pan , taps. tried adding clear overlay view hierarchy capture pinch, worked, clear overlay view blocks touches , taps correctly targeted @ blue subviews.
is there way pinch gesture working in situations in above diagram, or doomed being able recognize pinch if happens within 1 view in hierarchy?
my problem had smth common yours - uipinchgesturerecognizer didn't work on superview when both fingers on 1 subview. had uiscrollview in it, inner pich recognizer delaing own.
also problem solved setting gesture recognizer delegate , setting it's ability catch touches when recognizers
- (bool)gesturerecognizer:(uigesturerecognizer *)gesturerecognizer shouldrecognizesimultaneouslywithgesturerecognizer:(uigesturerecognizer *)othergesturerecognizer { return yes;}
but not case (needed them wait each other because of customer will)
Comments
Post a Comment