ios - Attach UISwipeGestureRecognizer to Multiple Views -


i have view controller normal view. in view, have 4 sub views. need each 1 react uiswipegesturerecognizer. hooked views uiswipegesturerecognizer in interface builder , hooked uiswipegesturerecognizer ibaction. works great; react uiswipegesturerecognizer.

but, need action different, depending on view called ibaction. should do? here's ibaction code:

- (ibaction)swipe:(uiswipegesturerecognizer *)sender {     switch (view)     {         case view1:             //do             break;          case view2:             //do             break;          case view3:             //do             break;          default:         //do         break;     } } 

how should handle this?

- (ibaction)swipe:(uiswipegesturerecognizer *)sender {     if (sender.view == view1) {         //do     }     if (sender.view == view2) {         //do     }     if (sender.view == view3) {         //do     } } 

don't complicate simple. besides, using tags force define same tags in nib if want reuse same controller nib, bad design.


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 -

.htaccess - Matching full URL in RewriteCond -