iphone - Multiple pan gestures in a mixing console app -


i ipad mixing console app able move multiple sliders simultaneously when user touches them multiple fingers, in real life.

i have implemented logic single pan gesture (uipangesturerecognizer). how add multiple-touch functionality in case?

there requirement of ios 5.1 compatibility.

edit: reference, here gesture looks on real-life mixing consoles:

enter image description here

you can create separate gesture recognizers each slider, e.g. assuming had collection outlet:

- (void)viewdidload {     [super viewdidload];      [self.sliders enumerateobjectsusingblock:^(uiview *slider, nsuinteger idx, bool *stop) {         uipangesturerecognizer *pan = [[uipangesturerecognizer alloc] initwithtarget:self action:@selector(handlepan:)];         [slider addgesturerecognizer:pan];     }]; } 

then, gesture recognizer handle each 1 individually (surprisingly, without needing recognize them simultaneously shouldrecognizesimultaneouslywithgesturerecognizer):

- (void)handlepan:(uipangesturerecognizer *)gesture {     cgpoint translation = [gesture translationinview:gesture.view];      gesture.view.transform = cgaffinetransformmaketranslation(0.0, translation.y);      if (gesture.state == uigesturerecognizerstateended)     {         cgrect frame = gesture.view.frame;         frame.origin.y += translation.y;         gesture.view.frame = frame;         gesture.view.transform = cgaffinetransformidentity;     } } 

Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -