objective c - How to add UIGestureRecognizer to multiple UISliders? -


i have problem when try add gesture recognizer many sliders using:

uigesturerecognizer *slidertap = [[[uitapgesturerecognizer alloc] initwithtarget:self action:@selector(slidertapped:)] autorelease]; [slider addgesturerecognizer:slidertap]; [slider2 addgesturerecognizer:slidertap]; ... 

only last 1 applied in app. have 10 sliders on screen @ 1 time. there way can make 1 uigesturerecognizer apply them all?

you can not assign single uigesturerecognizer multiple slider, need create separate 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


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -