I have some trouble to handle swipe on iPhone
, I create in my interface a UISwipeGestureRecognizer
var:
UISwipeGestureRecognizer *swipeRecognizer;
and in my controller : viewDidLoad
method
- (void)viewDidLoad
{
[super viewDidLoad];
// Horizontal swipe
swipeRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self
action:@selector(swipeMethod:)];
swipeRecognizer.direction = UISwipeGestureRecognizerDirectionRight | UISwipeGestureRecognizerDirectionLeft;
[self addGestureRecognizer:swipeRecognizer];
}
And my method to handle swipe is :
-(void)swipeMethod: (UISwipeGestureRecognizer *) sender
{
NSLog(@"Swipe!");
}
When I run my code and do a swipe I got nothing? I'm supposed to get : Swipe!
Thanks.