I have two views, one above another as a child.
View1—>View2 (View1 has View2 as a child)
How can I code this functionality?
1) if user TAPed on View2 – so the proper message tapped: sent to View2;
2) if user just moving finger over the View1(including View2) – events passed to View1 so it can handle touchesBegan: and so on.
So what I am trying to code is make one function “[View2 tapped:…]” if touch was short, and another function([View1 touchesBegan:..] and so on) if touch is moving.
In my case if I move finger over View2 – it never passes events to View1.
P.s. I did not rewrite hitTest or anything.
Gesture recognizers handle this sort of logic quite elegantly. Have a
UITapGestureRecognizeron view2, and do whatever you want on view1 (e.g. aUIPanGestureRecognizer). That takes care of all of the “what gestures are recognized by what views” logic you need.