Aggressor
Aggressor

Reputation: 13551

Moving A UILabel Inside A Movable UIView

I have a draggable UIView (specifically a UILabel) inside of a UIView.

Both the UIView and the nested UILabel have a touch-drag script. What I want to do is have it so that when I touch the UILabel, the UIView does not drag and I want to do this without setting flags every time, but rather have the touch event be "swallowed" by the UILabel and not be passed up to the parent UIView.

Is it possible to have nested views swallow UIGestureEvents so I don't have to put lots of flags everywhere?

Upvotes: 0

Views: 100

Answers (1)

matt
matt

Reputation: 535306

Yes, it's easy. You want to look at the UIGestureRecognizerDelegate methods. This is exactly what they are for - to decide between competing gesture recognizers.

Upvotes: 1

Related Questions