Ios 将手势滑动到特定限制

Ios 将手势滑动到特定限制,ios,iphone,uiview,uiswipegesturerecognizer,Ios,Iphone,Uiview,Uiswipegesturerecognizer,我需要执行特定限制的滑动手势。 我试着使用下面的代码 UIView *viewLeftSwipe = [[UIView alloc] initWithFrame:CGRectMake(30, 200, 100, 50)]; viewLeftSwipe.backgroundColor = [UIColor whiteColor]; viewLeftSwipe.userInteractionEnabled = YES; [self.view addSubview:viewLeftSwipe]; U

我需要执行特定限制的滑动手势。 我试着使用下面的代码

UIView *viewLeftSwipe = [[UIView alloc] initWithFrame:CGRectMake(30, 200, 100, 50)];
viewLeftSwipe.backgroundColor = [UIColor whiteColor];
viewLeftSwipe.userInteractionEnabled = YES;
[self.view addSubview:viewLeftSwipe];

UISwipeGestureRecognizer *swipeLeft = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipe:)];
[swipeLeft setDirection:UISwipeGestureRecognizerDirectionLeft];
[viewLeftSwipe  addGestureRecognizer:swipeLeft];
但它并没有调用下面的方法

- (void)handleSwipe:(UISwipeGestureRecognizer *)swipe
{
 NSLog(@"Swipe");
}

您是在滑动
viewLeftSwipe
还是在其他位置?是的,当滑动viewLeftSwupe时,我想执行一些操作我尝试了您的代码,它与handleSwipe一样工作正常:在执行滑动(方向-左)时调用方法。那你到底在找什么?