I got a card that is draw by a custom view. I want to add a swipe gesture to every card for flip and being chosen. Since every card view needs the gesture, I choose to add the gesture in the method initWithFrame: of the view. However,I want to leave it to my controller to handle this gesture when it was recognized because choosing the card is a method in my controller. Here is my code:
[self addGestureRecognizer:[[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipe:)]];
Actually I need the target to be my controller, I want to call a method named swipe in my controller. the target self only leave the handling of gesture to view itself.
Maybe I can't simply get my controller to replace the target.Can anyone tell my the correct way to solve this problem?