Прямо сейчас это код, который мне нужно обрабатывать жестами в webView:
UISwipeGestureRecognizer *swipeRight = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeRightAction:)];
swipeRight.direction = UISwipeGestureRecognizerDirectionRight;
swipeRight.delegate = self;
[webView1 addGestureRecognizer:swipeRight];
//</code>
UISwipeGestureRecognizer *swipeLeft = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeLeftAction:)];
swipeLeft.direction = UISwipeGestureRecognizerDirectionLeft;
swipeLeft.delegate = self;
[webView1 addGestureRecognizer:swipeLeft];
[super viewDidLoad];
}
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
{
return YES;
}
- (void)swipeRightAction:(id)ignored
{
NSLog(@"Swipe Right");
//add Function
}
- (void)swipeLeftAction:(id)ignored
{
NSLog(@"Swipe Left");
scrollView.contentOffset = CGPointMake(webView2.frame.origin.x, webView1.frame.origin.y);
}
Целью этого кода является прокрутка трех веб-представлений, расположенных рядом в прокрутке.
Он работает для первого веб-представления, но в конечном итоге я захочу применить этот жест ко всем веб-представлениям, и если я попытаюсь применить его ко второму, он не сработает для первого. Любые идеи относительно того, почему и возможное решение этой проблемы? Заранее спасибо!