我有一个页面视图控制器与五个视图控制器显示。滑动手势识别器没有触发?
我曾尝试添加这些轻扫手势,但他们没有被调用?
UISwipeGestureRecognizer *swipeGestureRight = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleRightSwipe:)];
swipeGestureRight.numberOfTouchesRequired = 1;
swipeGestureRight.direction = (UISwipeGestureRecognizerDirectionRight);
[self.scrollView addGestureRecognizer:swipeGestureRight];
UISwipeGestureRecognizer *swipeGestureLeft = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleLeftSwipe:)];
swipeGestureLeft.numberOfTouchesRequired = 1;
swipeGestureLeft.direction = (UISwipeGestureRecognizerDirectionLeft);
[self.scrollView addGestureRecognizer:swipeGestureLeft];
为什么没有这些被触发,我该怎么办呢?我的目标是检测用户滑动页面视图控制器的方向。
您添加的视图是否启用了用户交互? – AstroCB