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

  • Home
  • SEARCH
  • 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 6532017
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:56:54+00:00 2026-05-25T09:56:54+00:00

I have a question that might seem basic but can’t figure it out. Basic

  • 0

I have a question that might seem basic but can’t figure it out.

Basic question is: how do I programmatically put a gesturerecognizer into fail state from handler, while it’s in UIGestureRecognizerStateBegan or UIGestureRecognizerStateChanged?

More detailed explanation: I have a long press gesture recognizer for UIView inside a UIScrollView. I have made

-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer 
shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
    return YES;
}

because else I can’t get scroll view to scroll once user puts their finger down at the view. It’s basic touch like safari, where you hold finger down on a link, which highlights the link, but scroll up or down – then link is unhighlighted and scrollview moves.

I can get this mostly working right now since both gestures are being recognized, but it would be better if I can detect movement in longpress gesturerecognizer’s StateChanged, and if it’s more than 20 pixels or so, just programmatically make longpress fail.

Is this possible to do? Or am I digging at a wrong spot?

  • 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-25T09:56:55+00:00Added an answer on May 25, 2026 at 9:56 am

    Another question that I found right after I posted the question..

    Here’s what I do in the gesture recognizer handler now:

    else if (sender.state == UIGestureRecognizerStateChanged) {
        CGPoint newTouchPoint = [sender locationInView:[self superview]];
    
        CGFloat dx = newTouchPoint.x - initTouchPoint.x;
        CGFloat dy = newTouchPoint.y - initTouchPoint.y;
        if (sqrt(dx*dx + dy*dy) > 25.0) {
            sender.enabled = NO;
            sender.enabled = YES;
        }
    }
    

    So if finger moves more than 25 pixels in any direction, setting enabled property to NO will make the recognizer fail. So this will accomplish what I want!

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

Sidebar

Related Questions

I have a question that might seem basic but I just cannot figure out
I have a question that might seem simple, but yet I was unable to
OK, I realize that question might seem weird, but I just noticed something that
This might seem like a basic question and back to Http protocol 101. But
This might seem like a duplicate question, but I can't find any information on
This might seem like a simple question. But I have been looking for an
I have looked on the web but can't find anything that might help. My
Beginner level question Scenario: Have simple string cocantation tool, that I might expand later
I have a question that may be quite naive, but I feel the need
I have a question that I'm ashamed to ask, but I'm going to have

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.