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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:55:25+00:00 2026-05-22T17:55:25+00:00

I have two UIGestureRecognizers for a view that recognizes both simultaneously. I’d like for

  • 0

I have two UIGestureRecognizers for a view that recognizes both simultaneously. I’d like for the finish or cancellation of the primary gesture to kill the other gesture as well. So, is there a way to kill an active gesture, i.e. force the cancellation of an active gesture recognizer?

  • 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-22T17:55:26+00:00Added an answer on May 22, 2026 at 5:55 pm

    Since you want to kill the secondary gesture only when the primary gesture has ended or cancelled, do this in the gesture handler of the primary gesture.

    - (void)handleGesture:(UIGestureRecognizer*)gesture {
        ...
        if ( gesture.state == UIGestureRecognizerStateEnded || gesture.state == UIGestureRecognizerCancelled ) {
            secondaryGesture.enabled = NO;
            secondaryGesture.enabled = YES;
        }
    }
    

    This seems to be the only way you can cancel a gesture.


    You can use requireGestureRecognizerToFail: to declare a dependency.

    [secondaryGesture requireGestureRecognizerToFail:primaryGesture];
    

    This will kill the secondary gesture on successful identification of the primary gesture. There is no such tool provided if the primary gesture is cancelled. You can probably flip the enabled flag of the secondary gesture to NO and YES in the gesture handler of the primary gesture on UIGestureRecognizerStateCancelled but that doesn’t seem elegant.

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

Sidebar

Related Questions

I have 3 UIGestureRecognizers attached to a view: one finger double tap, two fingers
I have two applications written in Java that communicate with each other using XML
I have two relations A and B, both with all integer attributes (A {a1,a2,a3,...}
I have two classes Order and Items I want a method like this class
Have two fields start and end, both are dates, I want to write a
I have two BizTalk 2010 servers that belong to the same BizTalk group. They
I have two tables and want to compare rows on sqlite like this table1
Have two variables both containing integers: var input; var value; Need to perform arithmetic
I have two DataGridViews that have the same column schema (although two different DataViews
I have two convex polygons in 3D. They are both flat on different planes,

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.