我是新來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。 –