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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T13:32:19+00:00 2026-05-19T13:32:19+00:00

My app has a tab bar controller, one of the tab items is a

  • 0

My app has a tab bar controller, one of the tab items is a split view controller. It’s master view controller (ie. at index 0) is a navigation controller loaded from a nib, due to it’s custom navbar.

If that sounds a bit obscure, well it’s down to a combination of 1) not being able to add an SVC to a TBC in IB and 2) the iOS 4.2 splitview-navbar-colorTint bug. And indeed, it’s only since implementing the workaround yesterday that I’ve been experiencing a problem with low memory warnings.

Before the workaround I was initting the SVC with 2 nav controllers and adding it to the TBC all programatically (due to IB’s restricions with th tab bar) and without and problems – well, except for that apple bug.

The little workaround demo also works fine, even after low memory warnings. But it doesn’t involve the additional overhead of a tab bar.

But in my adaption of the workaround demo it starts to all go pear shaped. Send a low memory warning whilst showing the split view and the whole left side (master view) disappears. Behaviour identical on device, in fact I first discovered it there.

I’m puzzled what’s going on. The view on display (the nav cont’s root view) is controlled by a table view subclass. I’ve overridden didReceiveMemoryWarning but that doesn’t help. Furthermore (correspondingly!), the superview isn’t nil. It’s a UITableView. Perfectly correct.

So, I’m thinking the nav controller is getting released? But where? And why not in the original demo? The difference now is the addition of my tab bar controller. Here’s my code that adds it to the tab bar:

- (void) addTabItemSplitViewWithNavConRoot:(BOOL)hasRootNC {

    // init master/detail views 
    SV1RootViewController *rvc = [[SV1RootViewController alloc] initWithNibName:@"SVC1RootView" bundle:nil];
    SV1DetailViewController *dvc = [[SV1DetailViewController alloc] initWithNibName:@"SVC1DetailView" bundle:nil];

    rvc.detailViewController = dvc;

    UINavigationController *nc = nil;
    if (hasRootNC) {
        nc = [self.pSVC1.viewControllers objectAtIndex:0];
        nc.viewControllers = [NSArray arrayWithObjects:rvc, nil];
        nc.navigationBar.tintColor = [UIColor redColor];
    } else {
        nc = nil;
    }

    UIViewController *vc = (hasRootNC)? (UIViewController*)nc :rvc;

    UISplitViewController *svc = [self newSplitViewControllerWithMasterVC:vc detailVC:dvc];
    svc.delegate = dvc;

    // init the tab bar item
    svc.tabBarItem = [[UITabBarItem alloc] initWithTitle:(hasRootNC)? @"SplitView with Nav Root":@"Simple SplitView"
                                                   image:nil 
                                                     tag:0];    
    // int the split view
    NSMutableArray *controllersArray = [NSMutableArray arrayWithArray:self.pTabBarController.viewControllers];
    [controllersArray addObject:svc];
    [self.pTabBarController setViewControllers:controllersArray];

    // cleanup
    [nc release];
    [rvc release];
    [dvc release];
    [svc release];
}

- (UISplitViewController*) newSplitViewControllerWithMasterVC:(UIViewController*)masterView
                                                     detailVC:(UIViewController*)detailView {

    UISplitViewController *svc = [[UISplitViewController alloc] init];
    NSMutableArray *controllersArray = [NSMutableArray arrayWithObjects:masterView, detailView, nil];
    [svc setViewControllers:controllersArray];

    return svc;
}

Anybody have ideas for me please? 🙂

It’s driving me insane!!!

  • 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-19T13:32:20+00:00Added an answer on May 19, 2026 at 1:32 pm

    Resolved it. Had sth to do with that wierd mix of programatically initialising a split view controller, but injecting it with a nav controller read from the main window xib (all because of the custom toolbar needed for the Apple bug). But my guess is that the nav controller from the xib was having it’s view unloaded.

    So now I just take the entire SVC from the nib, rather than construct it by hand. Much neater and much simpler actually.

    Oh man. I was led astray by an answer to this question (the ‘designated’ answer!). I’ve now just noticed that this much simpler method is also given as an answer and is actually the most popular. Completely overlooked it! ^^

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

Sidebar

Related Questions

One of the tab bar controller tabs in my iPhone app changes what it
My app has two distincts modes. There's a tab bar controller in the app
I have an app with a tab bar. Each tab has its own view
I have an app that uses a tab bar controller. It has five tabs.
I am using a tab bar controller in my app but I load a
I work on a app which has only one way to get a working
My app has 4 tabs. All the view controllers support rotation, and indeed are
So my app's core is a tab bar. In each of 3 tabs is
I am trying to write an iPhone app that has both a UITabBar controller
i ve got a three tab bar where the first tab bar has got

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.