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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:04:07+00:00 2026-05-27T04:04:07+00:00

Working with XCode 4.2 and trying to get to grips with the UIGestureRecognisers. All

  • 0

Working with XCode 4.2 and trying to get to grips with the UIGestureRecognisers. All seems to be going fairly well so far, but am still having a few issues.

When I was using the Swipe gesture recognisers, everything was fine, it would recognise swipes in all different directions and would do so continuously. My problem now is, when using the pan gesture recogniser, it recognises the first pan swipe fine, but then just refuses to accept any further gestures. So I can move items about once as needed, but after that, can do nothing.

I set my gesture up as follows:

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

Then this is my ‘panBody’ method that handles it all:

- (void)panBody:(UIPanGestureRecognizer *)recognizer
{
CGPoint translate = [recognizer translationInView:self.view];

CGRect bodyPanelFrame = bodyPanel.frame;
bodyPanelFrame.origin.x += translate.x;
bodyPanelFrame.origin.y += translate.y;
recognizer.view.frame = bodyPanelFrame;

CGRect topPanelFrame = topPanel.frame;
topPanelFrame.origin.x += translate.x;
topPanelFrame.origin.y += translate.y;
recognizer.view.frame = topPanelFrame;

CGRect sidePanelFrame = sidePanel.frame;
sidePanelFrame.origin.x += translate.x;
sidePanelFrame.origin.y += translate.y;
recognizer.view.frame = sidePanelFrame;

NSLog(@"Panning");

if (recognizer.state == UIGestureRecognizerStateEnded)
{
    bodyPanel.frame = bodyPanelFrame;

    if((topPanel.frame.origin.x + translate.x) <= 193)
    {
        topPanel.frame = CGRectMake(topPanelFrame.origin.x, topPanel.frame.origin.y, topPanel.frame.size.width, topPanel.frame.size.height);
    }
    else
    {
        topPanel.frame = CGRectMake(193, 0, topPanel.frame.size.width, topPanel.frame.size.height);
        NSLog(@"Top panel not in frame");
    }

    if((sidePanel.frame.origin.y + translate.y) < 57)
    {
        sidePanel.frame = CGRectMake(sidePanel.frame.origin.x, sidePanelFrame.origin.y, sidePanel.frame.size.width, sidePanel.frame.size.height);
    }
    else
    {
        sidePanel.frame = CGRectMake(0, 56, sidePanel.frame.size.width, sidePanel.frame.size.height);
        NSLog(@"Side panel not in frame");
    }
}
}

bodyPanel, topPanel and sidePanel are IBOutlets linked to UIView’s overlayed across the top of my interface .xib

If anybody could shed any light on this information, that would be great cause I have absolutely no idea what is going on!!

Thanks,

Matt

  • 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-27T04:04:07+00:00Added an answer on May 27, 2026 at 4:04 am

    First I would check that

    if (recognizer.state == UIGestureRecognizerStateChanged)
    

    before doing your translations (there are many other possible states which would not justify you taking any action). Also I would reset the translation at every callback given you are accumulating them using the UIPanGestureRecognizer method

    - (void)setTranslation:(CGPoint)translation inView:(UIView *)view
    

    If the gesture recognizer stops it might be that another gesture recognizer is interfering with it. Do you still have an active UISwipeGestureRecognizer there? If so you should probably deactivate one of them. You can also look at this method

    - (void)requireGestureRecognizerToFail:(UIGestureRecognizer *)otherGestureRecognizer
    

    which allows you to specify which recognizer should be given priority.

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

Sidebar

Related Questions

I'm trying to make an SDL application in Xcode, but I'm having trouble loading
HELLO, I am working on XCODE 3.1.4 , my iphone have 3.1.2 os...But as
Something really weird is going on with Xcode and an iPhone project I'm working
I've been trying to get MOD_WSGI working on Apache via XAMPP on my Mac
I'm trying to monitor my core data usage but all the Core Data instruments
I am pretty new to xcode so forgive my mistakes but I am trying
I've been trying to get Ruby on Rails working on my Snow Leopard 64-bit
I'm trying to rebase...you can read all about my trials here . I'm working
I have been trying to replace everything in xcode with stuff I can get
But it's there. any ideas? It happens when I am trying to get metadata

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.