我是iPhone开发人员的新手,
我制作了epub阅读器并在我的webview中加载了epub的每一页
我想要的是,当用户第二次右键滑动手势然后我想导航到新页面时,我不想做第一次用户右手滑动手势时做任何事情.
UISwipeGestureRecognizer * swipeRight
有什么方法,比如
if(swipeRight.touch.count > 2) { // do this }
任何帮助都会得到满足.
提前致谢 !
编辑
-(void)scrollViewDidScroll:(UIScrollView *)scrollView{ float scrollViewHeight = scrollView.frame.size.height; float scrollContentSizeHeight = scrollView.contentSize.height; float scrollOffset = scrollView.contentOffset.y; if (scrollOffset == 0) { swipeUp = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeLeftAction:)]; swipeUp.direction = UISwipeGestureRecognizerDirectionUp; swipeUp.numberOfTouchesRequired=2; swipeUp.delegate = (id<UIGestureRecognizerDelegate>)self; swipeUp.cancelsTouchesInView=YES; [_webview addGestureRecognizer:swipeUp]; } else if (scrollOffset + scrollViewHeight == scrollContentSizeHeight) { swipeDown = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeRightAction:)]; swipeDown.direction = UISwipeGestureRecognizerDirectionDown; swipeDown.numberOfTouchesRequired=2; swipeDown.delegate = (id<UIGestureRecognizerDelegate>)self; swipeDown.cancelsTouchesInView=YES; [_webview addGestureRecognizer:swipeDown]; }
解决方法
只需将UIGestureRecognizer子类附加到该视图并保持调用…
UISwipeGestureRecognizer* rightSwipeRecognizer = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(someAction)]; rightSwipeRecognizer.numberOfTouchesRequired = 2; rightSwipeRecognizer.direction = UISwipeGestureRecognizerDirectionRight; rightSwipeRecognizer.cancelsTouchesInView = YES; [self.webView addGestureRecognizer:rightSwipeRecognizer]; // add in your webviewrightSwipeRecognizer
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。