我正在使用网页视图来渲染页面,我的网页视图在语音过度运行时运行良好但是当我打开双击工作时,单指滑动工作但是三根手指滑动甚至无法工作,即使是四根手指滑动也可用于切换应用。我可以得到一些帮助。我添加了UISwipeGestureRecognizer,有趣的是,当语音结束时,手势甚至没有调用gestureRecognizer,但语音结束时效果正常
- (void)viewDidLoad
{
[super viewDidLoad];
UISwipeGestureRecognizer *swipeRight = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeRightAction:)];
swipeRight.direction = UISwipeGestureRecognizerDirectionRight;
[myWebView addGestureRecognizer:swipeRight];
swipeRight.delegate = self;
UISwipeGestureRecognizer *swipeLeft = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeLeftAction:)];
swipeLeft.direction = UISwipeGestureRecognizerDirectionLeft;
[myWebView addGestureRecognizer:swipeLeft];
swipeLeft.delegate = self;
// Do any additional setup after loading the view, typically from a nib.
[myWebView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"anypage" ofType:@"html" inDirectory:@""] isDirectory:NO]]];
myWebView.delegate = self;
}
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
{
return YES;
}
- (void)swipeRightAction:(UISwipeGestureRecognizer *)swipeRight
{
NSLog(@"Swiped in Right Direction");
[self.myWebView stringByEvaluatingJavaScriptFromString:@"anyJSFunction();"];
}
- (void)swipeLeftAction:(UISwipeGestureRecognizer *)swipeLeft
{
NSLog(@"Swiped in Left Direction");
[self.myWebView stringByEvaluatingJavaScriptFromString:@"anyJSFunction();"];
}
答案 0 :(得分:0)
我解决了。需要添加辅助功能滚动。谢谢大家。
- (BOOL)accessibilityScroll:(UIAccessibilityScrollDirection)direction
{
NSLog(@"Accessibility Scroll Captured");
return YES;
}