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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T09:56:25+00:00 2026-06-07T09:56:25+00:00

I have a storyboard with 2 scenes. Each scene has a segue ctrl+dragged from

  • 0

I have a storyboard with 2 scenes. Each scene has a segue ctrl+dragged from ViewController icon to the other scene. Segue from first view to the second has identifier “left” and from the second to the first – “right”, both Segues point to the same custom class inherited from UIStoryboardSegue. Each ViewControllers has a title in Attribute Inspector, and don’t have any custom classes assigned to them just yet.

In AppDelegate I have UISwipeGestureRecognizer setup for all 4 directions and according to how user swipes if the current view controller has a segue with identifier “left”, “right”, “up”, or “down” it fires performSegueWithIdentifier:

- (void) handleSwipe:(UISwipeGestureRecognizer *) recognizer {
NSString *direction;
    switch ([recognizer direction]) {
        case UISwipeGestureRecognizerDirectionLeft:
            direction = @"left";
            break;
        case UISwipeGestureRecognizerDirectionUp:
            direction = @"up";
            break;
        case UISwipeGestureRecognizerDirectionDown:
            direction = @"down";
            break;
        default:
            direction = @"right";
            break;
    }
    @try {
        UIViewController *rootVC = self.window.rootViewController;
        [rootVC performSegueWithIdentifier:direction sender:rootVC];
    } @catch (NSException *e) {
        NSLog(@"Segue with identifier <%@> does not exist", direction);
    }
}

In my custom Segue class I override the “perform” method as follows (nothing fancy, since it breaks as is, but naturally I override it to be able to have a custom animation for segues later):

-(void) perform {
    UIViewController *src = (UIViewController *) self.sourceViewController;
    UIViewController *dst = (UIViewController *) self.destinationViewController;

    NSLog(@"source: %@, destination: %@", src.title, dst.title);

    [src presentModalViewController:dst animated:NO];
}

However, it only works once on the first swipe to the left and after that nothing happens. I can see via the NSLog in the “perform” method that segue’s source and destination view controllers don’t change for some reason after this first transition and just stay the same onward. It looks like I am missing something simple, but I can’t figure it out.

Don’t be too harsh on me 😉 , I am new to the iOS development.

  • 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-07T09:56:26+00:00Added an answer on June 7, 2026 at 9:56 am

    I think it’s because you’re always performing the segue on the rootViewController and the segue is just calling presentModalViewController. A controller can only have 1 modal at a time; if you want to keep presenting modals you need to present them from the view controller at the top of the stack. I have no idea if that’s what you mean to do.. it doesn’t really make sense to keep showing modals unless you want to be able to pop backwards through the controller stack.

    If you don’t actually want the modals, you can just replace the rootViewController in your segue with the destination:

    -(void) perform {
        UIViewController *dst = (UIViewController *) self.destinationViewController;
        // do some animation first
        [[[UIApplication sharedApplication] delegate].window.rootViewController = dst;
    }
    

    It should also be noted that it is very weird to have a gesture recognizer on the app delegate like you mention in your question. It would make a lot more sense to implement your own UIViewController subclass that does the swipe handling and calls performSegueWithIdentifier: on itself.

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

Sidebar

Related Questions

I have an iOS 5 application with a storyboard and two scenes. Scene 1
I have a storyboard setup as a Tabbed Application with first view controller containing
I have a storyboard application. When the first view is loaded on startup, I
To set the scene I have: A Tab View Controller with 2 tabs Each
I have a storyboard as seen in this picture: From a table view cell,
I built in my storyboard this myView view controller scene: I have a simple
I have a huge crazy scene in my story board that has 36 different
I have a simple iOS 5 storyboard that contains a tableview controller scene. However,
I have a storyboard with a UIViewController. Inside this view, I've placed a custom
I have a modal storyboard scene that I want to be accessible to all

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.