I have a UIGestureRecognizer that I want to work with two different UIViews, both of which are in the same hierarchy of UiViewController views. The action of UIGestureRecognizer is about the same for everyone, so I would like the same function to be called (it will obviously), and I will tell you at runtime what from the UIView I'm dealing with. But how? I do not see that UIGestureRecognizer carries information about the object. Am I missing a line in the documentation or does gestureRecognizer not know to which object it was attached to the one to which it was called? It seems like the language should have known.
Alternatively, perhaps I do not understand the intent of the class, and I should not:
UITapGestureRecognizer *dblTap = [[UITapGestureRecognizer alloc] initWithTarget: self action: @selector(handleDblTap:)]; [viewA addGestureRecognizer: dblTap]; [viewB addGestureRecognizer: dblTap];
and then expect that you can:
-(void)handleDblTap: (UIGestureRecognizer *)gestureRecognizer { if (viewA)...
If in fact UIGestureRecognizer does not support simultaneous joining to several objects, then if you know why this does not support this, could you enlighten me? Thanks for the help.
Stonebreaker
source share