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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:55:22+00:00 2026-06-17T15:55:22+00:00

It seems like this should be simple, but it is apparently not so. I

  • 0

It seems like this should be simple, but it is apparently not so.

I am using Storyboards, with my first view controller defined as LogbookFirstViewController.

The contents of this controller are inside of a UIControl. That way I can detect taps.

However, I can see no easy way to determine when a user has started swiping across the screen. All I want to do is get the touches x-coordinate. Essentially track it.

I dropped a UIPanGestureRecognizer inside LogbookFirstViewController, and attached it’s outlet too:

In .h

@property (assign) IBOutlet UIGestureRecognizer *gestureRecognizer;

Of course, I then synthesized it and set the delegate:

In .m

[gestureRecognizer setDelegate:self];

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

    UITouch *touchLoc = [touches anyObject];
    CGPoint beginCenter = self.view.center;
    CGPoint touchPoint = [touchLoc locationInView:self.view];

    deltaX = touchPoint.x - beginCenter.x;
    deltaY = touchPoint.y - beginCenter.y;
    NSLog(@"X = %f & Y = %f", deltaX, deltaY);
}

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

    // Set the correct center when touched
    touchPoint.x -= deltaX;
    touchPoint.y -= deltaY;

    self.view.center = touchPoint;
}

However, this does nothing. It doesn’t even detect -(void)touchesBegan

What am I missing? Thanks in advanced.

  • 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-17T15:55:23+00:00Added an answer on June 17, 2026 at 3:55 pm

    Those methods are not delegate methods, they’re only for subclassing UIGestureRecognizer.

    Typically you instantiate a gesture recognizer and specify a selector (a method) to call when that gesture is recognized and then you assign it to a view, for example:

    UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(pan:)];
    [self.view addGestureRecognizer:pan]
    

    Then in your pan method you can query information from teh gesture:

    - (void)pan:(UIPanGestureRecognizer *)gesture
    {
        // get information from the gesture object
    }
    

    I’ve never done it with a StoryBoard but I suppose if you have a property already in your view controller you could call addTarget:action: and attach it to a view in the view controllers viewDidLoad method.

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

Sidebar

Related Questions

This seems like it should be so simple, but apparently it isn't. I have
This feels like it should be pretty simple, but not much seems to be
This seems like it should have such a simple solution, but apparently it doesn't.
Seems like this should be simple, but powershell is winning another battle with me.
This seems like it should be very simple but I can't get it to
This seems like it should be really simple, but I'm unable to figure this
Seems like this should be super-simple but looking around for a simple (or half-way
Seems like this should be simple, but I don't find it in a net
Seems like this should be a simple thing to do, but the date/time operations
It seems like this should be so simple, but I am pretty new at

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.