开发者

problem with swip gesture recognizers in iOS

开发者 https://www.devze.com 2023-03-18 08:06 出处:网络
I am using the following code : UISwipeGestureRecognizer *swipeRecognizer = [[UISwipeGestureRecognizer alloc]

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号