我是新来iPhone
开发商,检测轻扫手势的UIWebView
我做了EPUB阅读器和加载EPUB的每一页我webview
我想要什么,当用户执行right swipe gesture
第二次的话,我要导航到新的页面,我不想做任何事情,当用户执行right swipe gesture
首次。
UISwipeGestureRecognizer *swipeRight
有什么方法类似,
if(swipeRight.touch.count > 2)
{
// do this
}
任何帮助将appriciated。
在此先感谢!
编辑
-(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];
}
如果网页视图中滚动视图然后yourcrollview.canCancelTouches = NO;和webView.exclusiveTouches = YES。 –