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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:10:03+00:00 2026-05-25T02:10:03+00:00

Before: My App is based on indepent view controllers. I can switch from one

  • 0

Before:

My App is based on indepent view controllers. I can switch from one to another by replacing the root view controller on the application delegate:

ade.window.rootViewController = newController;

… and all worked right, till now.

Tomorrow:

we have to add a NavigationController-based part of our App, which will help the users navigate through our:

Brands => Model Names => Colors

So, the user will choose a color, then click a button: now I will switch to another UIViewController (call it “pippo”), which actually resides outside that navigation hierarchy (I can’t push it in the nav-controller for several methods, I’m forced doing so!).

What I want is to get back to my “Color” screen, from “pippo”. So, I’m looking for a way to programmatically “navigate” the navigation controller I restore, I mean:

  • I restore my navigation controller

  • now I’m on Brands, but I don’t want my users to be here, I want to show them the last color they was on (I saved it in the preferences)

  • how can I simulate the selection of a known brand and model?

Thanks a lot.

  • 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-25T02:10:03+00:00Added an answer on May 25, 2026 at 2:10 am

    In applicationDidFinishLoading in App delegate:

    UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:rootViewController];
    
    [window makeKeyAndVisible];
    [window addSubview:navController.view];
    

    That will instantiate the navigation controller and add it to the window as a view.

    Now, in your rootViewController class (lets say its called FirstViewController) you can do this:

    - (void)clickedAButton:(id)selector {
      SecondViewController *nextViewController = [[SecondViewController alloc] initWithNibName:nil bundle:nil];
      // and push it onto the 'navigation stack'
      [self.navigationController pushNavigationController:nextViewController animated:YES];
      // and release
      [nextViewController release];
    }
    

    And in your SecondViewController you can navigate back through the stack using:

    - (void)clickedAnotherButton:(id)selector {
      // goes back to the last view controller in the stack
      [self.navigationController popViewControllerAnimated:YES];
    }
    

    So for you it would go:

    Set up navigation controller in the app delegate with Brand as the root view controller
    User chooses their brand and you pushViewController:animated: the Model view controller. Then the user chooses their model and you pushViewController:animated: the Color view controller. Similarly the user chooses a color and you push the Pippo view controller. Now, if the user presses back (or you call popViewControllerAnimated:) it will go back to the Color view controller in the same state as when the user left it to go to the Pippo controller.

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

Sidebar

Related Questions

I need to display a view before I display a tab based app and
Possible duplicate: How can i give app store link in my apps before approving
In a controller in my Rails app, I can do this: before_filter :login_required, :except
I've never done a Java Web start application before. I wrote my app's JNLP
I have a application developed based on Compact Framework 1.0. I can run it,
In a view based app, I display a view and once the user is
I have a simple iPhone app based on a navigation controller. There are two
I am calling a web service from a C# forms based app. ServReturnType obj
I have a content based, read-only iPhone app. Users can select favorite topics, which
I am creating an application based on the Speak Here example app . I

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.