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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:20:25+00:00 2026-06-14T11:20:25+00:00

I have a tab bar controller with two tabs. The first tab displays a

  • 0

I have a tab bar controller with two tabs. The first tab displays a table view of things of type A. If you click on a cell a view of type A is pushed onto a navigation stack. As you would expect, this view has a back button that pops the view from the navigation stack and displays the table view of things of type A.

The second tab displays a table view of things of type B. If you click on a cell a view of type B is pushed onto a navigation stack. Again, as you would expect, this view also has a back button that pops the view from the navigation stack and displays the table view of things of type B.

The type A view also has a button that conceptually converts the type A thing to a type B thing. Visually, the type A view is replaced with a view of type B. Behind the scenes, I need to pop the type A view off of the navigation stack, change tabs to the table things of type B and pop a type B view controller onto a navigation stack so that the type B view’s back button will take the user back to the table of things of type B.

My first idea for implementing this was to link the button on my type A view to my implementation of the tab bar controller, which pops off the existing type A view, changes tabs to the list of type B things and then pushes type B view onto the navigation stack. But this creates an otherwise unnecessary reference to the tab bar controller from the type A view.

Is there a better way to do this? Perhaps with a custom segue?

  • 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-14T11:20:27+00:00Added an answer on June 14, 2026 at 11:20 am

    Since posting my question, I learnt that it isn’t necessary to maintain my own explicit reference to the tab bar controller because each UIViewController has the property: parentViewController.

    This means that I can access my custom tab bar controller from my type A view without maintaining my own reference. As a result, my code is a bit simpler now. When the button on the view of type A is pressed the following code is executed in Type A’s view controller:

    [(MyCustomTabBarController *)[[self parentViewController] parentViewController] switchToViewOfTypeB:referenceToObjectOfTypeA];
    

    Where switchToViewOfTypeB is the code on the custom tab bar controller that performs the segue.

    I like this approach better than using a notification in this case because it is clear from the type A view that it is the custom tab bar that is responsible for performing the segue.

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

Sidebar

Related Questions

Here's the setup: I have a tab bar controller with two tabs. There is
I have a tab bar controller with three tabs. Tab number two has a
I have a tab bar controller with two tabs: tabBar1View with a button named
I have a tab bar controller in the master view of a split view
I have a root view of UINavigationController containing a UITabBarController. The tab bar controller
I have two tabs. Tab 1 and Tab2. In tab2 I have a table
I have two tabs in the application. From tab 2 on a particular view
I have an app with a tab bar controller (2 tabs). In one tab
I have a tab bar controller with two views. When i press a button
I have a Tab Bar Controller with two views (and two buttons at the

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.