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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T12:20:02+00:00 2026-06-06T12:20:02+00:00

I present a modal view controller for various UI settings in an iOS app.

  • 0

I present a modal view controller for various UI settings in an iOS app. One of those settings allows the user to select a different main view. When they hit “Done” I want to dismiss the modal view and have the newly-selected view controller appear, without a momentary delay where the old view controller segues to the new view controller. How could this be implemented?

Update:

Here is a method I successfully implemented using Eugene’s technique, but without the app delegate. Instead, this implementation is specific to my scenario where a view controller in a navigation stack presents the modal view controller in a Utility app.

- (void)swapFrontSideViewController;
{
    UINavigationController *navigationVC = (UINavigationController *)[self presentingViewController];
    NSMutableArray *viewControllers      = [NSMutableArray arrayWithArray:navigationVC.viewControllers];
    UIViewControllerSubclass *selectedViewController = nil;
    if ([self.selectedFrontSide isEqualToString:FRONT_SIDE_NAME1]) {
        selectedViewController = [self.storyboard instantiateViewControllerWithIdentifier:FRONT_SIDE_NAME1];
    } else if ([self.selectedFrontSide isEqualToString:FRONT_SIDE_NAME2]) {
        selectedViewController = [self.storyboard instantiateViewControllerWithIdentifier:FRONT_SIDE_NAME2];
    }
    if (selectedViewController) {
        [viewControllers replaceObjectAtIndex:viewControllers.count -1 withObject:selectedViewController];
        [navigationVC setViewControllers:viewControllers];
        self.delegate = selectedViewController;
    } else {
        NSLog(@"Error: Undefined Front Side Selected.");
    }
}
  • 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-06T12:20:04+00:00Added an answer on June 6, 2026 at 12:20 pm
    - (IBAction)doDismiss:(id)sender {
      AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate; // Get the app delegate
      NSMutableArray *viewControllers = [NSMutableArray arrayWithArray:appDelegate.navigationController.viewControllers]; // fetch its navigationController viewControllers stack
      UIViewController *replacementController; //initialize replacement controller
      [viewControllers replaceObjectAtIndex:viewControllers.count -1 withObject:replacementController]; // replace the top view controller in stack with the replacement one
      [appDelegate.navigationController setViewControllers:viewControllers]; //change the stack
      [self dismissModalViewControllerAnimated:YES];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I present a modal view controller from the app delegate's view, the
I'm trying to present a Modal View Controller when the app enters in foreground..
here the following code is used to view the present modal view controller. [[self
I need to present a modal view controller before showing a split view controller.
I'm trying to present a modal view controller after selecting a contact and it
I am trying to present a modal view controller. I have read the documentation,
Is it possible to present a modal view controller in such a way that
Is it possible to present my modal view controller with the keyboard already visible?
I have a simple project to present a modal view controller and transfer back
I need to present a modal view controller and be notified when it is

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.