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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:04:36+00:00 2026-05-27T04:04:36+00:00

I am trying to make an app with two different tab bar controllers, one

  • 0

I am trying to make an app with two different tab bar controllers, one for a pre-logged in state, and one for an post-logged in state. My current strategy is to create all the views, add them to two arrays (one for each tabBarController) and then switch the tabBarController assigned as the subview with some logic.

I am currently having problems with the views that are common between the two tabBarControllers. If I only make one tabBarController from one Array, everything works great. But when I try to make a second array with the same views in the first array, all of the common views no longer appear in the tabBarController with views from the original array.

First I’m not sure if this is even the correct approach to my problem. Second I am not sure why pointers in one array seem to lose their references when adding the pointers to another array.

Here is my code:

NSArray *loggedViewControllers = [NSArray arrayWithObjects:squareView, circleView,     starView, diamondView, nil];
loggedTabBarController.viewControllers = loggedViewControllers;

NSArray *notLoggedViewControllers = [NSArray arrayWithObjects:squareView, circleView, diamondView, nil];
notLoggedTabBarController.viewControllers = notLoggedViewControllers;

[release squareView];
[release circleView];
[release diamondView];
[release starView];

[self.window addSubview:[loggedTabBarController view]];
[self.window makeKeyAndVisible];

From if I run this code I will get a tab bar with blank, starView, blank blank.

If I run the following:

[self.window addSubview:[notLoggedTabBarController view]];

Everything appears fine.

Thank for help.

  • 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-27T04:04:36+00:00Added an answer on May 27, 2026 at 4:04 am

    I don’t this approach is going to work.

    When you add a view as a subview to another view, it first removes that view from the superview it is currently in (if it is in one).

    Since the TabView managed by the TabBarController is a subclass of UIView it will behave the same way – so when you add the view to the TabBarControllers view list, and it thus subsequently adds that view as a subview to its TabBarView, it will also be removing that view from the other TabBarControllers TabView.

    You would be better off looking at the delegate methods of TabViewController I think, and just manage one single list in one TabViewController.

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

Sidebar

Related Questions

I am trying to make an app that will pass data between two servers
I am trying to implement two different searchable activities, one for honeycomb(with search widget)
I'm trying to make a Core Data app in which when you select one
I'm trying to make my app a good Windows citizen, so I use matching
I'm trying to make my app publish to all my friend's walls. From what
I have an app with tabbar and webview. I'm trying to make the app
I am trying to make a web app in Dashcode that uses a range
I'm trying to make a console app that would monitor some process and restart
I'm trying to make a simple app that sits on the Mac OSX menu
I am trying to make my web app compatible with international languages and 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.