I need to catch swipe-action only on special area. But debugger tells unrecognized selector sent to instance
- (void)viewDidLoad
{
UISwipeGestureRecognizer *swipeLeft = [[UISwipeGestureRecognizer alloc]
initWithTarget:self.viewName action:@selector(didSwipe:)];
swipeLeft.direction = UISwipeGestureRecognizerDirectionLeft;
[self.view addGestureRecognizer:swipeLeft];
}
-(void)didSwipe:(UISwipeGestureRecognizer*)swipe{
NSLog(@"swiped left");
}
whats wrong?
You probably want the target to be
selfnotself.imageName.Edit In response to your comments.
You want your
targetto be the place where the method lives. In this case that should beself. You want to add your gesture recognizer to the view that is supposed to be touched,self.viewName.