How to know when StatusBar size changed (iPhone)

Posted by JOM on Stack Overflow See other posts from Stack Overflow or by JOM
Published on 2010-03-29T12:37:26Z Indexed on 2010/03/30 7:33 UTC
Read the original article Hit count: 459

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.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about uitabbarcontroller