1

I have a ModalView called with :

    PreferencesController *nextWindow = [[[PreferencesController alloc] initWithNibName:@"Preferences" bundle:nil] autorelease];
    nextWindow.wantsFullScreenLayout = YES;
    UINavigationController* navController = [[[UINavigationController alloc] initWithRootViewController:nextWindow] autorelease];

    [self presentModalViewController:navController animated:YES];

It is initialised like this :

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.navigationController.navigationBarHidden = YES;
    self.title = @"Options";
}

When I set, on a button click (for test) :

- (IBAction)ClickIt:(id)sender {
    self.navigationController.navigationBarHidden = NO;
}

Then the navigtion bar is displayed, but then the whole view goes down with a transparent space on the Top of the view, with a size of a status bar. The simulated elements in the xibs for the status bar are set to OFF, as for all the other simulated elements.
Due to this space, the bottom content of the view goes out of screen.
I tried to force self.wantsFullScreenLayout = YES after having set navigationBarHidden = NO but that does not change anything.

For information, if I change viewDidLoad like this :

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.navigationController.navigationBarHidden = NO;
    self.title = @"Options";
}

Then the problem is the same without having to click the test button.

What could be the problem ?

Oliver
  • 23,072
  • 33
  • 138
  • 230
  • 1
    Might be related to [this question](http://stackoverflow.com/questions/2393868/how-do-i-get-the-navigation-bar-in-a-uinavigationcontroller-to-update-its-positio). Have you tried settings the wantsFullScreenLayout property on the navigation controller, too? – hennes Mar 19 '11 at 14:05
  • @hennes : thank you, that was the good link to my proble. I've set [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone]; on the application load and the problem disapeared. – Oliver Mar 19 '11 at 14:48
  • @hennes : could you post you comment as an answer as I could accept it ? – Oliver Mar 19 '11 at 14:49

1 Answers1

1

As indicated in this question you might need to hide the statusbar before presenting your full screen view controller, for instance directly on application load.

Community
  • 1
  • 1
hennes
  • 9,147
  • 4
  • 43
  • 63