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 9229577
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T05:36:23+00:00 2026-06-18T05:36:23+00:00

In my application, I have a file viewer that displays multiple types of content

  • 0

In my application, I have a file viewer that displays multiple types of content (images, pdf, text, etc) in a UIWebView.

I have swipe controls for flipping to the next page, and these generally work fine as long as the image is smaller than the webview and no scrolling is needed. Here is the code for that:

UISwipeGestureRecognizer *swipeRight = [[UISwipeGestureRecognizer alloc] initWithTarget:self  action:@selector(swipeRightAction:)];
swipeRight.direction = UISwipeGestureRecognizerDirectionRight;
swipeRight.delegate = self;
[webView addGestureRecognizer:swipeRight];

However, if the an image is too large, the swipe controls no longer work.
I have read a few other questions, where people have tried similar things but with no success.

I have seen seen suggestions for subclassing UIWebView, but haven’t had any luck with this approach either.

Is there a way to add swipe controls to a UIWebView that will work consistently?

  • 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-18T05:36:24+00:00Added an answer on June 18, 2026 at 5:36 am

    For my case, I ultimately did manage to get this working subclassing UIWebView. I also created a new delegate that is called when the directions swipes are performed.

    This may not be the best solution, but it is simple, reusable, and works.

    Here is some of the basic code:

    @interface SwipableWebView : UIWebView <UIGestureRecognizerDelegate>{
       id swipeableWebViewDelegate;
    }
    @property (nonatomic, retain) id <SwipableWebViewDelegate> swipeableWebViewDelegate;
    @end
    
    
    @implementation SwipableWebView{
    
    }
    
    @synthesize swipeableWebViewDelegate;
    
    - (id)initWithCoder:(NSCoder *)aDecoder{
      self = [super initWithCoder:aDecoder];
      if (self) {
          UISwipeGestureRecognizer  * swipeRight = [[UISwipeGestureRecognizer     alloc]initWithTarget:self action:@selector(swipeRight:)];
        swipeRight.direction = UISwipeGestureRecognizerDirectionRight;
        [self addGestureRecognizer:swipeRight];
        swipeRight.delegate = self;
    
        UISwipeGestureRecognizer  * swipeLeft = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(swipeLeft:)];
        swipeLeft.direction = UISwipeGestureRecognizerDirectionLeft;
        [self addGestureRecognizer:swipeLeft];
        swipeLeft.delegate = self;
    
    
        UISwipeGestureRecognizer  * swipUp = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(swipeUp:)];
        swipUp.direction = UISwipeGestureRecognizerDirectionUp;
        [self addGestureRecognizer:swipUp];
        swipUp.delegate = self;
    
        UISwipeGestureRecognizer  * swipeDown = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(swipeDown:)];
        swipeDown.direction = UISwipeGestureRecognizerDirectionDown;
        [self addGestureRecognizer:swipeDown];
        swipeDown.delegate = self;
      }
      return self;
    }
    
    
    
    -(void)swipeLeft:(id)swipe{
      [swipeableWebViewDelegate webViewSwipeLeft:swipe];
    }
    
    -(void)swipeRight:(id)swipe{
      [swipeableWebViewDelegate webViewSwipeRight:swipe];
    }
    
    -(void)swipeUp:(id)swipe{
      [swipeableWebViewDelegate webViewSwipeUp:swipe];
    }
    
    -(void)swipeDown:(id)swipe{
      [swipeableWebViewDelegate webViewSwipeDown:swipe];
    }
    
     - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer{
        return YES;
    }
    
    @end
    
    
    
    @protocol SwipableWebViewDelegate <NSObject>
     -(void)webViewSwipeLeft:(id)swipe;
     -(void)webViewSwipeRight:(id)swipe;
     -(void)webViewSwipeUp:(id)swipe;
     -(void)webViewSwipeDown:(id)swipe;
    @end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application that has the Viewer role for PDF files. Although my
We have a web application that displays a variety of document types to the
I have stucking in my application. I have developing a pdf viewer application. I
I have a web application that runs multiple websites from one codebase. I have
I have a custom application that has an embedded Crystal Reports viewer. The RPT
I have the following code that pulls a pdf document from a remote viewer
Hi In my application i have created a text file in isolated storage and
I have a VC++ application and in my application i have some basic file
I have always wondered about this. So many application setups have a zip file
We have a file manager-like application where we use the action bar home button

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.