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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:32:35+00:00 2026-06-04T19:32:35+00:00

I am having some trouble with my UIView transition method that is listening for

  • 0

I am having some trouble with my UIView transition method that is listening for gestures on the screen.

Whats happening is, if I do a left swipe or a right swipe its sending a left and right swipe signal to my @selector method.. meaning I cannot differentiate between the swipes.

Here’s my code in question.. I have tried a few different things, but cannot seem to get this one right.

- (void) setupSwipeGestureRecognizer {
        UISwipeGestureRecognizer *swipeGesture = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipedScreen:)];
        swipeGesture.direction = (UISwipeGestureRecognizerDirectionLeft | UISwipeGestureRecognizerDirectionRight);
        [self.view addGestureRecognizer:swipeGesture];
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    self.title = @"Prototype";
    //Initalizse the swipe gestuer listener
    [self setupSwipeGestureRecognizer];

    //alloc and init
    self.detailViewA = [[DetailViewController alloc]initWithNibName:@"DetailViewController" bundle:[NSBundle mainBundle]]; 
    self.detailViewB = [[DetailViewControllerB alloc]initWithNibName:@"DetailViewControllerB" bundle:[NSBundle mainBundle]];

    // set detail View as first view
    [self.view addSubview:self.detailViewA.view];

    // set up other views
    [self.detailViewB.view setAlpha:1.0f];

    // Add the view controllers view as a subview
    [self.view addSubview:self.detailViewB.view];

    // set these views off screen (right)
    [self.detailViewB.view setFrame:CGRectMake(320, 0, self.view.frame.size.width, self.view.frame.size.height)];    
}


- (void)swipedScreen:(UISwipeGestureRecognizer*)gesture
{
    if (gesture.direction = UISwipeGestureRecognizerDirectionLeft) {
        NSLog(@"Left");
    }
   if (gesture.direction = UISwipeGestureRecognizerDirectionRight){
       NSLog(@"Right");
   }

}
  • 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-04T19:32:37+00:00Added an answer on June 4, 2026 at 7:32 pm

    Similar questions here and here.

    The parameter to your swipedScreen: method is of type UISwipeGestureRecognizer i.e. the recognizer that caused the callback to be called. It does not refer to any actual gesture that the user made. In your case you set the direction property of this recognizer to be (UISwipeGestureRecognizerDirectionLeft | UISwipeGestureRecognizerDirectionRight) – this will not have changed.

    You will have to create two recognizers, one for each direction.

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

Sidebar

Related Questions

I´m having some trouble retrieving a collection of strings in a projection: say that
I'm trying to add a UIButton to a UIView, but am having some trouble
I'm having trouble creating a UIView (in Interface Builder) that contains a UITableView with
having some trouble with my razor syntax gives a Parsor error saying that The
having some trouble with a Thread (CanvasThread) that is intermittently pausing at random points
Im having some trouble reading xml files using jquery that containts swedish chars (åäö)
I am having some trouble with Xcode not updating files that I have updated
So having some trouble with a class methods. I'll post all the information that
I'm having some troubles adding an UIView to cocos2d v2.0 since the openGlView is
Having some trouble with R's garbage collection, when passing objects to C++. We have

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.