Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8180129
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T00:09:00+00:00 2026-06-07T00:09:00+00:00

I want add UIGestureRecognizerDelegate to UIWebView,but failed. if [self.view addsubView:webView]; So UIWebView is ok,but

  • 0

I want add UIGestureRecognizerDelegate to UIWebView,but failed.

if [self.view addsubView:webView];
So UIWebView is ok,but not UIGestureRecognizerDelegate..

if remove [self.view addsubView:webView];
So UIGestureRecognizerDelegate is ok,but view nothing at all.

- (void)viewDidLoad {
    [super viewDidLoad];

webView= [[UIWebView alloc] initWithFrame:CGRectMake(0.0f, -2.0f, 320.0f, 415.0f)];

if (_refreshHeaderView == nil) {
    webScroller = (UIScrollView *)[[webView subviews] objectAtIndex:0];
    [webScroller setDelegate:self];

    EGORefreshTableHeaderView *view = [[EGORefreshTableHeaderView alloc] initWithFrame:CGRectMake(0.0f, 0.0f - webScroller.bounds.size.height, self.view.frame.size.width, webScroller.bounds.size.height)];
    view.delegate = self;
    [webScroller addSubview:view];
    _refreshHeaderView = view;
}

[_refreshHeaderView refreshLastUpdatedDate];

[self.view addSubview:self.webView];


// Set up recognizers.
UITapGestureRecognizer *doubleTapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleGesture:)];
doubleTapRecognizer.numberOfTapsRequired = 2;
doubleTapRecognizer.delegate = self;
[self.view addGestureRecognizer:doubleTapRecognizer];

UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleGesture:)];
tapRecognizer.delegate = self;
[self.view addGestureRecognizer:tapRecognizer];

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T00:09:01+00:00Added an answer on June 7, 2026 at 12:09 am

    If you want to add the Gesture Recognizer to the webView and not the main view of your application which is under the webView, after you add your webView as a subView to the main View, then you should change your “addGestureRecognizer” like this…

        UITapGestureRecognizer *doubleTapRecognizer = [[UITapGestureRecognizer alloc] 
                                                   initWithTarget:self action:@selector(handleGesture:)];
    doubleTapRecognizer.numberOfTapsRequired = 2;
    doubleTapRecognizer.delegate =self;
    [self.webView addGestureRecognizer:doubleTapRecognizer];
    UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc] 
                                                   initWithTarget:self action:@selector(handleGesture:)];
    tapRecognizer.numberOfTapsRequired = 1;
    tapRecognizer.delegate = self;
    [self.webView addGestureRecognizer:tapRecognizer];
    

    Then as this is a UIWebView you should also conform to the protocol UIGestureRecognizerDelegate in your header file and then return YES from the following methods. This way the UIWebView gestures and your own will both be handled, otherwise yours will be hidden by the UIWebView’s own recognizers.

    - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer{
    return YES;}
    - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer{
    return YES;}
    - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
    return YES;}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want add my custom sidebar next right column all page. Please check this
I want add days to an NSDate . The approach below is not working.
I am working in jQuery script.But a little bit problem i want add the
I try using Devexpress Layout-Control (For costume usage). So I want add all item's
I want add a separator in Blackberry Listfield inside drawListRow with graphics.drawLine Method but
i want add a new user in lotus notes using java program but i
I want add a new field in my database, and set all rows values
I want to add same additional fields to my form, but I don't want
I want Add Select Activity values as first values of HTML dropdown, but when
I want add alias to my .irbrc similary like alias q exit (work). But

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.