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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T08:47:00+00:00 2026-05-21T08:47:00+00:00

I am using XCode to develop a Cocoa touch application for the iOS platform

  • 0

I am using XCode to develop a Cocoa touch application for the iOS platform but have had trouble finding out how to get a swipe gesture implemented that would allow the user to swipe their finger left or right to change to a new ViewController (nib/xib file). I have done a swapView IBAction using a button and modal transitioning and I have read about Apple’s TouchGestureRecognizer but I don’t know how to implement a swipe action that would allow a view change.

I do NOT want to use a scroll view, as I have several dozen view controllers, that I want the user to be able to swipe through.

Here is an example:

First View Controller.xib:
SwipeRight- Go to second View Controller.xib

Second View Controller.xib:
SwipeLeft- Go to first View Controller.xib
SwipeRight- Go to third View Controller.xib

etc, etc

I have not used UISwipe/Touch Gestures before but I have used an IBAction method to switch views using a button with Modal Transitioning (see below):

-(IBAction)swapViews; { 
    SecondViewController *second2 =[[SecondViewController alloc initWithNibName:@"SecondViewController" bundle:nil];
    second2.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
    [self presentModalViewController:second2 animated:YES];
    [second2 release];
}

Is using a swipe to do a similar method formatted differently? If so, how do I sort this out and format it.

Thank You

Edit – Answer as Per Comment on Question

Place this in your viewDidLoad

UISwipeGestureRecognizer *swipeRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeLeftDetected:)];
swipeRecognizer.direction = UISwipeGestureRecognizerDirectionLeft;
[self.view addGestureRecognizer:swipeRecognizer];
[swipeRecognizer release];

Then add a selector as by pasting the following code into your main…

- (IBAction)swipeLeftDetected:(UIGestureRecognizer *)sender {
    NC2ViewController *second2 =[[NC2ViewController alloc] initWithNibName:@"NC2ViewController" bundle:nil];
    second2.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
    [self presentModalViewController:second2 animated:YES];
    [second2 release];
}

Then just make sure you import the otherViewController you are swapping to using

#import "SecondViewController"

at the top of your main file. Hope this helps.

End Edit

  • 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-21T08:47:01+00:00Added an answer on May 21, 2026 at 8:47 am

    This sounds like a perfect time to use UIGestureRecognizer or, more specifically, UISwipeGestureRecognizer.

    For more info on how to use them, read up in the Gesture Recognizers section of the Event Handling Guide.

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

Sidebar

Related Questions

I am using Corona to develop ios app. I use XCode as IDE. But
I'm new to development using Xcode, and am having trouble using the built-in Leaks
I want to develop a Safari plugin using Xcode, and I want to access
I want to develop Safari plugin using xCode, What API should I use? Someone
Can you develop for the latest iOS4, using XCode 3.2? Do I need to
I am using XCode for developing a C++ Console Application. After compiling XCode generates
I'm diving into iOS development and I'm using Xcode on a multi-monitor setup. Obviously
I have a project that uses SystemConfiguration.Framework. I've been using xcode, where adding the
I'm using XCode 3 to develop MAC and iPhone apps. Because I'm thinking of
Using XCode 3.2.3 (64-bit), I get following strange output. What am I doing 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.