Catching UIGestureRecognizer only on the parent view
I Have two view contr开发者_如何学编程ollers that can hold the same component as a subView.
The component implements handling UIDragGestureRecognizer.
Controller A also handles drag gestures and should override the default drag behavior of the component.
So the problem is that if the component is a subView of controller B than i want the component to catch drag events, but if it's a subView of controller A than i don't want it to catch drag events.
Adding a UIDragGestureRecognizer to controllerA.view causes both the controller and the component to receive the drag event which is bad for me.
How can I make sure that the component will not receive drag events if it's a subView of controller A? (I'm adding the UIGestureRecognizer to the component at initialization and at that time i still don't know which controller will hold it).
[component removeGestureRecognizer:component.myGestureRecognizer];
精彩评论