problem with swip gesture recognizers in iOS
I am using the following code :
UISwipeGestureRecognizer *swipeRecognizer =
[[UISwipeGestureRecognizer alloc]
initWithTarget:self
action:@selector(swipeDetected:)];
swipeRecognizer.direction = UISwipeGestureRecognizerDirectionRight;
[self.view addGestureRecognizer:swipeRecognizer];
[swipeRecognizer release];
And,
- (void)swipeDetected:(UIGestureRecognizer *)sender {
NSLog(@"R开发者_JAVA百科ight Swipe");
}
But I dont see any output when I swipe in the simulator. Can anyone please help me out ? Thanks.
Since you have a UITableView
, it may be blocking the action. Try adding the swipeGesture
directly to the tableView
.
精彩评论