开发者

Catching UIGestureRecognizer only on the parent view

开发者 https://www.devze.com 2023-04-04 21:44 出处:网络
I Have two view contr开发者_如何学编程ollers that can hold the same component as a subView. The component implements handling UIDragGestureRecognizer.

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];

0

精彩评论

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

关注公众号