0

I have a problem that when I try to add my Gesture Recognizer to many sliders using:

UIGestureRecognizer *sliderTap = [[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(sliderTapped:)] autorelease];
[slider addGestureRecognizer:sliderTap];
[slider2 addGestureRecognizer:sliderTap];
...

Only the last one is applied in the app. I have up to 10 sliders on the screen at one time. Is there a way I can make one UIGestureRecognizer apply to them all?

CHiroshiWard
  • 163
  • 1
  • 11

1 Answers1

0

You can not assign single UIGestureRecognizer to multiple slider, You need to create separate for each.

UIGestureRecognizer *sliderTap = [[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(sliderTapped:)] autorelease];
UIGestureRecognizer *sliderTap2 = [[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(sliderTapped2:)] autorelease];

[slider addGestureRecognizer:sliderTap];
[slider2 addGestureRecognizer:sliderTap2];

For Reference check this

Community
  • 1
  • 1
Toseef Khilji
  • 17,192
  • 12
  • 80
  • 121