我需要将滑动手势实现到特定限制。 我尝试使用以下代码
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");
}