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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T18:58:27+00:00 2026-06-14T18:58:27+00:00

I am developing an iOS application that handles a hierarchy of UIViewController objects using

  • 0

I am developing an iOS application that handles a hierarchy of UIViewController objects using a UINavigationController:

MenuViewController
  |
  |-ListOfAnimalsViewController
    |
    |-AnimalDetailsViewController
  |
  |-ListOfPlantsViewController
    |
    |-PlantDetailsViewController

The application receives local NSNotification objects with information of a certain animal or plant. The usual behavior when you touch the notification is to open the application and load the first view controller in hierarchy.

Is there a way of programmatically navigating to an instance of a UIViewController deep in the hierarchy instead?

EDIT: I am not asking for pushing the controller into the navigation stack, but for pushing the previous controllers as well, i.e. I would like to keep the navigation schema above.

  • 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-14T18:58:29+00:00Added an answer on June 14, 2026 at 6:58 pm

    I’m gonna have to disagree with Suresh. While this solution may work in a simple case like this where you only have 1 previous ViewController, what if you wanted to add a 10th ViewController and keep the entire hierarchy? First of all you’d have to pass the final piece of data you want to show (in this case the plant or animal) through every ViewController and you’d be creating 10 ViewControllers at once. The transition between the current ViewController and the 10th would be far from seamless, performance would be terrible. Also no need to go and create your own navigation system, no need to make things more complicated than they are since this issue isn’t too difficult.

    Just push the ViewController you want to show, that way you’ll only be creating 1 ViewController. In every ViewController that can be pushed as a result of a notification (and all the ones below that), override the behavior of the back button. Check in the viewControllers property of the navigationController if the ViewController before is is the one you expect, using NSStringFromClass. If not, create an NSMutableArray as a copy of the viewControllers, create the ViewController you do expect and insert it at the second to last spot in the array. Then replace the entire stack by calling the setViewControllers:animated: method on the navigationController with the mutable array, animated NO. Finally do the pop. Again you’ll have created just 1 ViewController at a time, keeping your performance optimal.

    Ican’t post code right now since I’m on an iPad but if you need it, just ask and I’ll add an example when i have a real keyboard.

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

Sidebar

Related Questions

I'm developing an iOS 5 application using BLE that needs to monitor connections to
We are developing an iOS Application that connects to a server over https using
First of all, sorry for my English... I'm developing an iOS application that has
I'm developing an iOS 4 application. I have a main view that contains another
I'm developing an iOS 4 application with latest SDK and XCode 4.2. I'm using
I'm developing an iOS 4 application. I have this ViewController: @interface BlogViewController : UIViewController
I'm developing an iOS application , that will take a twits from twitter, I'm
I am new in ios development.Now,i am developing an Ipad application using ios 4.2
I'm developing an iOS application that will be used just by a company employees
I'm developing an iOS 4 application. I have a ViewController that contains another class.

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.