【发布时间】:2015-07-23 23:56:21
【问题描述】:
我有一个页面视图控制器,其中包含五个显示的视图控制器。
我已尝试添加这些滑动手势,但没有被调用?
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];
为什么没有触发这些,我该怎么办?我的目标是检测用户滑动页面视图控制器的方向。
【问题讨论】:
-
您添加的视图是否启用了用户交互?
标签: ios objective-c xcode swipe