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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:57:51+00:00 2026-06-05T05:57:51+00:00

I looked through other solutions, yet I can’t find the right solution for myself.

  • 0

I looked through other solutions, yet I can’t find the right solution for myself.
I have a UIImageView within a UIScrollView, where I show big pictures.

I have pinch gesture enabled within my UIScrollView as well as left and right swipe gesture recognizers.

Right now, scrollview’s pan gesture seems to disable, (or corrupt) swipe gestures. I don’t want to disable horizontal or vertical scrolling on my UIScrollView, and initial scaling of my photos are too large to disable horizontal scrolling.

What I want to do is to trigger swipe gesture when i come at the edge of my UIScrollView.

Here are some codes;

- (void)viewDidLoad
{
    // recognizer for pinch gestures
    UIPinchGestureRecognizer *pinchRecognizer =[[UIPinchGestureRecognizer alloc]initWithTarget:self action:@selector(handlePinch:)];
    [self.myScrollView addGestureRecognizer:pinchRecognizer];
    [self.myScrollView setClipsToBounds:NO];

    // recognizer for swipe gestures
    UISwipeGestureRecognizer *recognizer;

    // left and right swipe recognizers for left and right animation
    recognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleLeftSwipe:)];
    [recognizer setDirection:(UISwipeGestureRecognizerDirectionRight)];
    [[self myScrollView] addGestureRecognizer:recognizer];

    recognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleRightSwipe:)];
    [recognizer setDirection:(UISwipeGestureRecognizerDirectionLeft)];
    [[self myScrollView] addGestureRecognizer:recognizer];
    ....

My left swipe handler, currently left and right swipes don’t have any additional features

-(void)handleLeftSwipe:(UISwipeGestureRecognizer *)recognizer
{    
    if(!self.tableView.hidden) self.tableView.hidden = YES;
    [self showRequiredStuff];
    CATransition *transition = [CATransition animation];
    transition.duration = 0.75;
    transition.timingFunction = [CAMediaTimingFunction     functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
    transition.type = kCATransitionPush;
    transition.subtype =kCATransitionFromLeft;
    transition.delegate = self;
    [self.view.layer addAnimation:transition forKey:nil];

My initial screen size;

#define IMAGE_VIEW_WIDTH 320.0
#define IMAGE_VIEW_HEIGHT 384.0

I use scaling for pictures, to make them scale as small as they can be, but most of them are wide images, which case horizontal scrolling is enabled, and vertical scrolling is disabled. Although my swipe handlers are horizontal as well.

I suppose I have clearly explained what is going on and what I need. I have posted codes because I am a newbie on iphone application development, I both want to help other people to see as much code as they can, and maybe someone will point out any bad programming, and we all will benefit from it.

Additional findings from related solutions;
After setting;

@interface myViewController () <UIScrollViewDelegate>

and

self.myScrollView.delegate = self;

Detecting if a the edge is reached, horizontally

- (BOOL) hasReachedAHorizontalEdge {
    CGPoint offset = self.myScrollView.contentOffset;
    CGSize contentSize = self.myScrollView.contentSize;
    CGFloat height = self.myScrollView.frame.size.height;
    CGFloat width  = self.myScrollView.frame.size.width;

if ( offset.x == 0 || 
    (offset.x + width) == contentSize.width ) {
    return YES;
}

    return NO;

}

- (void) scrollViewDidScroll:(UIScrollView *)scrollView {
    if ( [self hasReachedAHorizontalEdge] ) {
        NSLog(@"Reached horizontal edge.");
        // required here 
    }
}

At this point, all I need to disable the scrolling at the reached end, etc. if I reached right edge of scroll, I need to disable only right scrolling, that way swipe will be triggered.

  • 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-05T05:57:52+00:00Added an answer on June 5, 2026 at 5:57 am

    I added a thin UIView over the edges of my scrollView and have them recognize swipes. I could not get the scrollView to cooperate with another swipe gesture recognizer. This isn’t ideal, but it works for now. I will have to investigate if there is a way to override the scrollView’s swipe gesture recognizer.

    The trick would be to check and see if the swipe starts near the edges, and then to decide whether to call the scrollView’s or my swipe recognizer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have looked through these forums to find a solution to this problem, and
I have looked through other similar entries, and not found a solution. I have
I looked through other questions and couldn't find what I needed. Best if I
I've looked through the other solutions on SO and none of them seem to
I have googled this, searched this, looked through SO and other sites (I've been
OK so I have looked theough the other solutions an no help. So here
I looked through other StackOverFlow questions, but I'm a little confused. I'm trying to
I looked through the other posts and bug reports and couldn't figure out what's
I've looked through numerous other questions up here surrounding a negative lookbehind for JavaScript
I looked through the existing questions of this kind but didn't find what I

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.