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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T06:46:05+00:00 2026-05-23T06:46:05+00:00

I have 2 tab bars in a tabbar controller, each with a nav controller.

  • 0

I have 2 tab bars in a tabbar controller, each with a nav controller. Upon a given action, i would like to execute one command in one, and one in the other one. Example:

// in my current tabbar, pop back to root view
[self.navigationController popToRootViewControllerAnimated:YES];

// go to the first tab bar
self.tabBarController.selectedViewController 
= [self.tabBarController.viewControllers objectAtIndex:0];

When performed individually, the code above works. However, when laid out in the sequence above, only the first command is executed, while the second one is not executed.

The weird is that when i switch the sequence, it works.

What is happening here to cause these 2 different scenarios?

  • 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-23T06:46:05+00:00Added an answer on May 23, 2026 at 6:46 am

    As soon as you do,

    [self.navigationController popToRootViewControllerAnimated:YES];
    

    You are detaching the view controller from the navigation stack. This will set the navigationController property to nil as it no longer belongs to that stack. It would be inappropriate for the property to contain a valid value.

    Same thing applies to the tabBarController property. It would be set as long as the navigation controller was part of the tab bar controller or it was part of that navigation controller. This is set to nil as well at the end of that statement.

    Switching the statements will work as it doesn’t alter the navigation stack until your task is done.

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

Sidebar

Related Questions

I have a tab navigator control and I would like to make all of
I have a tab contol with two tabs. Each one containing listviews. When the
I have an application with a tab bar controller and each view contains a
I have a Tab bar application. and in one of the tab bars I
I have two views. I want to place two different tab bars in each
How would one go about modifying the colour of vim's tab bar? I have
i have a problem is i got UItabbarController it contain 3 Tabbars each tabbar
I have a tab delimited file where each record has a timestamp field in
I have tab bar application and when i press on one of the tabs
I have 2 tabbars in my tabbar controller. I am currently in the second

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.