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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T00:47:03+00:00 2026-06-19T00:47:03+00:00

I cannot figure out what is wrong. Below is my code, and it calls

  • 0

I cannot figure out what is wrong. Below is my code, and it calls the delegate methods once then stops.

What should I do? I haven;t been able to find the sample code that uses these delegate methods. All I’ve found were gesture recognizers for swipes and taps, using different delegates.

Code so far:

-(void)initTouchesRecognizer{

    DLog(@"");

    recognizer = [[UIGestureRecognizer alloc] init];

    [self addGestureRecognizer:recognizer];

}


-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{


    DLog(@"");


    NSSet *allTouches = [event allTouches];
    for (UITouch *touch in allTouches)
    {


    }

}




-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
    UITouch *touch = [[event allTouches] anyObject];
    CGPoint location = [touch locationInView:touch.view];

}




- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
       DLog(@"");

}



- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {
    [self touchesEnded:touches withEvent:event];
}

I call initTouchesRecognizer from initwithrect for my image view.

What am i doing fundamentally wrong?

  • 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-19T00:47:04+00:00Added an answer on June 19, 2026 at 12:47 am

    UIGestureRecognizer is an abstract class, you’re not supposed to add it directly to your view. You need to use a concrete subclass that inherits from UIGestureRecognizer, like UITapGestureRecognizer or UIPanGestureRecognizer for example. You could also make your own concrete subclass but that usually isn’t necessary.

    Here is an example of adding a UIPanGestureRecognizer to your view (in your view class code, often the gesture is added to the view from the controller):

    UIPanGestureRecognizer *panGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(mySelector:)];
    [self addGestureRecognizer:panGesture];
    

    In this case, the selector will be called when ever the user pans in this view. If you added a UITapGestureRecognizer, the selector would be called when the user tapped.

    You can check out the apple docs for more info:
    http://developer.apple.com/library/ios/#documentation/EventHandling/Conceptual/EventHandlingiPhoneOS/GestureRecognizer_basics/GestureRecognizer_basics.html#//apple_ref/doc/uid/TP40009541-CH2-SW2

    Also, I find Paul Hagerty’s Stanford lectures to be great, here’s one on gesture recognizers:
    https://itunes.apple.com/ca/course/6.-views-gestures-january/id593208016?i=132123597&mt=2

    You should also understand that none of the methods that you posted are delegate methods, and none of them have anything to do with the UIGestureRecognizer that you added in your code. Those are instance methods of UIResponder (a class that UIView inherits from) that you’re overriding. The abstract UIGestureRecognizer also has instance methods with those same names, but it is not the UIGestureRecognizer methods that are getting called in your class.

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

Sidebar

Related Questions

I have been staring at this code and cannot figure out what is wrong
In the code below, I cannot figure out a way of passing a member
I have read a few posts but cannot figure out what is wrong.My Code
I have nearly tried everything but cannot figure out what is wrong. I have
I cannot figure out why this doesn't work. It seems so simple. It should
I cannot figure out how to convert this code from C# to VB.net. It
Something wrong with my IF-ELSE statement and my dumb brain cannot figure out what
I am trying to figure out what I have done wrong with my code
I cannot figure out what is wrong with this fql.multiquery and cannot seem to
probably it is a simple mistake but I cannot figure out what is wrong.

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.