开发者

multi-fingers UIPanGestureRecognizer behavor with CGRectContainsPoint

I have a main view that divided into 4 equally sized sub-views. I used UIPanGestureRecognizer with 3 fingers to trigger an event based on which 1 of those 4 views using the CGRectContainsPoint method.

My goal is that three fingers have to be in the same view when the motion started/ended to trigger the appropriated event handling for that view.

The problem was that if I start with my 3 fingers not in the same view (2 fingers in view1 and 1 finger in view2 etc.) The event 开发者_JAVA技巧handling that got triggered was the one with 2 fingers at the end since I am using the UIGestureRecognizerStateEnded method etc.

Is there a technique to make sure that the event handling get triggered if and only if 3 fingers started at the same view (CGRect) and ended with the same view (CGRect)?

btw: I am using the same procedure for other UIXXXGestureRecognizer and they all worked as designed.

Thank you.


I just compared the location for UIGestureRecognizerStateBegan state and the location for UIGestureRecognizerStateEnded to make sure it is within the specific view.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜