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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T01:11:43+00:00 2026-06-01T01:11:43+00:00

Other then setting UIGestureRecognizers in a Controller: UISwipeGestureRecognizer *swipeGesture = [[UISwipeGestureRecognizer alloc] initWithTarget:v action:@selector(handleSwipe:)];

  • 0

Other then setting UIGestureRecognizers in a Controller:

UISwipeGestureRecognizer *swipeGesture = [[UISwipeGestureRecognizer alloc] 
               initWithTarget:v action:@selector(handleSwipe:)];
swipeGesture.direction= UISwipeGestureRecognizerDirectionUp;
[v addGestureRecognizer:swipeGesture];

And making a method in a view available

-(void)handleSwipe:(UISwipeGestureRecognizer *)sender {
    NSLog(@"Swipe detected");
}

Is there anything else needed? If not, what am i missing please? When gesture is simulated, NSlog is not printing

  • 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-01T01:11:44+00:00Added an answer on June 1, 2026 at 1:11 am

    Edit

    I see from your recent question that you are also using a pan gesture recognizer. Gesture recognizers don’t really know how to play well with each-other without instruction. You have two main options

    1) One or the other:

    [panGesture requireGestureRecognizerToFail:swipeGesture];
    

    The pan only fires if the touch is not a swipe. or-

    2) Both at the same time:

    Conform the the UIGestureRecognizerDelegate protocol.

    Set the delegates:

    panGesture.delegate = self;
    swipeGesture.delegate = self;
    

    And implement the method:

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

    Original

    Right now you are setting your view v as the target of the recognizer, so essentially when the swipe is detected the recognizer calls:

    [v handleSwipe:self];
    

    It seems more likely that both of your methods are in a view controller. If that’s the case then the init method should look like this:

    UISwipeGestureRecognizer *swipeGesture = [[UISwipeGestureRecognizer alloc] 
               initWithTarget:self action:@selector(handleSwipe:)];
    

    Since v is the intended target and with that in mind your code is fine; I would think the next most likely cause is that your first chunk of code runs before the view v loads. i.e. the code is not in viewDidLoad after v already exists. If you’re unsure a simple log will confirm it’s existence:

    NSLog(@"v is %@",v);
    

    If that proves to be a dead-end we will definitely require more info on this view v. What is it’s superclass? Are there other recognizers on it? How is it added to the view?

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

Sidebar

Related Questions

Does anyone know of a really good editor to debug JavaScript (other then Visual
I have a DBAdmin class that connects to the database, and then some other
The app will run fine, then crash - literally every other time. It seems
I opened up Business Intelligence Design Studio (BIDS) the other day. Since then my
I know, nobr tag is deprecated, then how can i do this with other
Recently I've found myself writing methods which call other methods in succession and setting
Other than self.class.send :method, args... , of course. I'd like to make a rather
Other than pasting a WDSL in the tech spec, what are the recommended ways
Other than standard OO concepts, what are some other strategies that allow for producing
Other than using raw XML, is there an easy way in .NET to open

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.