Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS PhoneGap app upgraded to Cordova 2.1 - content ignores status bar entirely

Tags:

ios

cordova

I just finished upgrading an iOS PhoneGap app to Cordova 2.1. The app builds fine, but when running it on the simulator, the content of the app seems to completely ignore the fact that the status bar is there. 20px of content is hidden underneath the status bar now and I cannot seem to add padding to shift it down even.

How do I fix this?

like image 343
Rob Lauer Avatar asked Sep 25 '12 17:09

Rob Lauer


1 Answers

If you upgraded your application to use PhoneGap 2.1 from another version, your MainViewController.m file may not be up to date.

You need to have the following code in it:

#pragma mark - View lifecycle

- (void)viewWillAppear:(BOOL)animated
{
    // Set the main view to utilize the entire application frame space of the device.
    // Change this to suit your view's UI footprint needs in your application.
    self.view.frame = [[UIScreen mainScreen] applicationFrame];

    [super viewWillAppear:animated];
}

Once you have this function, your App will be back to normal!

(Solution found here)

like image 174
scotsqueakscoot Avatar answered Sep 22 '22 17:09

scotsqueakscoot