detect Swipe gesture in UIWebview

前端 未结 4 1633
走了就别回头了
走了就别回头了 2021-01-14 15:54

I am new to iPhone developer,

I made epub reader and loaded each page of epub in my webview

What i want to is, when user does

4条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-14 16:31

    Just attach UIGestureRecognizer subclass to that view and hold on for calls...

    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
    

提交回复
热议问题