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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T23:50:49+00:00 2026-05-17T23:50:49+00:00

My app setup is a UITabBar with three tabs. In each tab is a

  • 0

My app setup is a UITabBar with three tabs. In each tab is a different UINavigationController.

In the first tab there is a refresh button – this loads in a load of data from the web (xml). The data is displayed in the three tab bars.

How do I release the UINavigationControllers whenever someone refreshes the data? The reason I want to to this is when then data changes the various tabs might have completely new data to display, so it would be a bit dangerous to keep that screen .. if that makes sense. So I want to completely refresh the UINavigationControllers and show the first view in the navigation stack when they click on a tab again.


Thanks to Ryan for his answer. The way I did was something like this

for(UINavigationController *navController in [self.navigationController.tabBarController viewControllers]) {
    NSLog(@"popping %@", [navController title]);
    [navController popToRootViewControllerAnimated:NO];
    if ([[navController title] isEqualToString:@"Tab2"])
    {
        Tab2RootController *newRoot2 = [[Tab2RootController alloc] initWithNibName:@"Tab2RootController" bundle:nil];
        newRoot2.title = @"Tab2";
        [navController setViewControllers:[NSArray arrayWithObject:newRoot2] animated:NO];
        //need [newRoot2 release]?
    }
    if ([[navController title] isEqualToString:@"Tab3"])
    {
        Tab3RootController *newRoot = [[Tab3RootController alloc] initWithNibName:@"Tab3RootController" bundle:nil];
        newRoot3.title = @"Tab3";
        [navController setViewControllers:[NSArray arrayWithObject:newRoot3] animated:NO];
        //need [newRoot3 release]?
    }
}
  • 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-17T23:50:49+00:00Added an answer on May 17, 2026 at 11:50 pm

    popToRootViewController will pop all the view controllers on the stack except for the root view controller. If you want to also get rid of the root view controller, you need to replace it entirely, using -[UINavigationController setViewControllers:animated:]. Of course, you’ll need to have your new root view controller set up already. It would look something like this (amending MattLeff’s answer, above):

    -(void)showRootNavigationControllers {
        for(UINavigationController *navController in [tabBarController viewControllers]) {
            // You do this: set up the new root view controller for the given tab and assign it to a variable, e.g. newRootControllerForTab...
    
            // Now set that new root controller as the only view controller in the nav controller.
            [navController setViewControllers:[NSArray arrayWithObject:newRootControllerForTab] animated:NO];
        }
    }
    

    Note that this will instantly switch the view controllers, with no animations. By setting the entire list of view controllers for each navbar, they will release the old view controllers, and they’ll be deallocated as long as no one else has retained them.

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

Sidebar

Related Questions

Here is my app setup. TabBar App with three tab items, tabs 2 and
I have a CountDownTimer in my app setup like this: new CountDownTimer(11000, 1000) {
Most answers to this questions suggest to make sure your Twitter app is setup
My app is setup so that when it's first used, it downloads the required
I have this app setup with in-app purchase. If I am logged in on
I have an app setup where each user belongs to a company, and that
I have an MVC 1.0 app just setup but it only shows the Index.aspx
I've got the following in conf.py : def setup(app): app.add_config_value('base_url','http://localhost:2000', True) How do I
I have setup an app project and a static project in a workspace in
How can you setup an app that will ask for permission to access contacts

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.