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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T08:09:05+00:00 2026-05-28T08:09:05+00:00

Actually i want to implement swipe left and right in UIScrollview. i have scrollview

  • 0

Actually i want to implement swipe left and right in UIScrollview. i have scrollview with content size (768,1500). i have tried this but problem is that sometimes its not detecting swipe and perform scrolling there. so now i want to disable scrolling on 2 finger touch.

swipeGesture = [[[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(nextswipedScreen:)] autorelease];
swipeGesture.numberOfTouchesRequired=2;
swipeGesture.direction = UISwipeGestureRecognizerDirectionLeft;         
[self addGestureRecognizer:swipeGesture];

swipeGesture = [[[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(previousswipedScreen:)] autorelease];
swipeGesture.numberOfTouchesRequired=2;
swipeGesture.direction = UISwipeGestureRecognizerDirectionRight;            
[self addGestureRecognizer:swipeGesture]; 

i have tried custom scrollview for that but i have problem with touchesBegan method. its not calling every time. even i tried this but not able to stop two finger scroll in UIScrollview.

for (UIGestureRecognizer *mgestureRecognizer in _scrollView.gestureRecognizers) {     
        if ([mgestureRecognizer  isKindOfClass:[UIPanGestureRecognizer class]])
        {
            UIPanGestureRecognizer *mpanGR = (UIPanGestureRecognizer *) mgestureRecognizer;
            mpanGR.minimumNumberOfTouches = 1; 
            mpanGR.maximumNumberOfTouches = 1;
        }
    }

Let me know if you have any solution or alternative for that.

  • 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-05-28T08:09:06+00:00Added an answer on May 28, 2026 at 8:09 am

    I had the same problem; I needed to disable two-finger scrolling so that I could detect a two-finger swipe to the left or right. Here’s what I did to set up my scroll view:

    - (void) setUpGestureHandlersOnScrollView:(UIScrollView *)scrollView {
        // set up a two-finger pan recognizer as a dummy to steal two-finger scrolls from the scroll view
        // we initialize without a target or action because we don't want the two-finger pan to be handled
        UIPanGestureRecognizer *twoFingerPan = [[UIPanGestureRecognizer alloc] init];
        twoFingerPan.minimumNumberOfTouches = 2;
        twoFingerPan.maximumNumberOfTouches = 2;
        [scrollView addGestureRecognizer:twoFingerPan];
    
        // set up the two-finger left and right swipe recognizers
        UISwipeGestureRecognizer *twoFingerSwipeLeft = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleGestureFrom:)];
        twoFingerSwipeLeft.direction = UISwipeGestureRecognizerDirectionLeft;
        twoFingerSwipeLeft.numberOfTouchesRequired = 2;
        [scrollView addGestureRecognizer:twoFingerSwipeLeft];
    
        UISwipeGestureRecognizer *twoFingerSwipeRight = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleGestureFrom:)];
        twoFingerSwipeRight.direction = UISwipeGestureRecognizerDirectionRight;
        twoFingerSwipeRight.numberOfTouchesRequired = 2;
        [scrollView addGestureRecognizer:twoFingerSwipeRight];
    
        // prevent the two-finger pan recognizer from stealing the two-finger swipe gestures
        // this is essential for the swipe recognizers to work
        [twoFingerPan requireGestureRecognizerToFail:twoFingerSwipeLeft];
        [twoFingerPan requireGestureRecognizerToFail:twoFingerSwipeRight];
    }
    

    The handler method should look something like this:

    - (void)handleGestureFrom:(UISwipeGestureRecognizer *)recognizer {
        if ([recognizer numberOfTouches] == 2) {
            // do whatever you need to do
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Actually I am new to iphone development and want to implement Toast for this
Note: This is a hypothetical discussion. I don't actually want to implement a struct
Somehow my master and my origin/master branch have diverged. I actually don't want them
There are actually 2 question i want to cover in this topic. 1) Is
I'm currently making a site where i want to implement multi-language version. which actually
I want to implement a sort of preview mechanism for my application. I have
I want to implement the strict folding functions myself, from within Haskell: Is this
How do I enumerate the properties of a JavaScript object? I actually want to
I got a question ;) Actually I want to use core-data in different threads.
I want to know what actually happens when you annotate a method with @Transactional

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.