views:

198

answers:

0

I have UITabBarController with 2 tabs. One resizes just fine, when StatusBar size changes (emulator "Toggle In-Call Status Bar" menu item). The other one doesn't.

The problematic tab item contains a static view, which dynamically loads one or another view depending on certain things. While getting this setup working I discovered that main tab view did NOT automagically send e.g. viewWillAppear and viewWillDisappear messages to my dynamic subviews.

Apple docs explained this was because dynamically added views were not recognized by the system.

@interface MyTabViewController : UIViewController
{
    UIView *mainView;
    FirstViewController *aController;
    SecondViewController *bController;
}
...
if (index == 0)
{
    self.aController = [[FirstViewController alloc]
        initWithNibName:@"FirstViewController" bundle:nil];            
    [self.mainView addSubview:aController.view];
    [self.aController viewWillAppear:YES];
}

How can I get StatusBar size changed event into my dynamic subviews? The "didChangeStatusBarFrame" doesn't work, as documented elsewhere.