我正在尝试在UIScrollView上使用左右滑动功能,但是在iPhone模拟器中似乎只有向右滑动可以正常工作,而向左滑动没有反应。我有任何步骤遗漏了吗?
- (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated];
self.scrollView.multipleTouchEnabled = YES; UISwipeGestureRecognizer *swipe = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipe:)]; swipe.delaysTouchesBegan = YES; swipe.numberOfTouchesRequired = 2; [self.scrollView addGestureRecognizer:swipe]; [swipe release]; }
- (void)handleSwipe:(UISwipeGestureRecognizer *)recognizer { if (recognizer.direction == UISwipeGestureRecognizerDirectionLeft) {
} else if (recognizer.direction == UISwipeGestureRecognizerDirectionRight) {
} }