My PhoneGap application was messed up on iOS 7, like apparently most are at first - the status bar was clear & the text was on top of (overlapping) my app's HTML-based navigation bar. I fixed that by:

In [app name] info.plist:

 View controller-based status bar : NO    
 Status bar style : UIStatusBarStyleLightContent

In MainViewController.m underneath - (void)viewWillAppear:(BOOL)animated is:

self.view.frame = [[UIScreen mainScreen] applicationFrame];

[super viewWillAppear:animated];
NSArray *vComp = [[UIDevice currentDevice].systemVersion 

componentsSeparatedByString:@"."];

if ([[vComp objectAtIndex:0] intValue] >= 7) { // iOS 7 or above

    CGRect oldBounds = [self.view bounds];
        /* Changing the -20 to 0 takes away the black bar 
           at the top, making the status bar text overlap
           my content again... positive 20 of course makes
           my content cut off by 20px at the top, so obviously
           this is the cause of the problem */
           CGRect newBounds = CGRectOffset(oldBounds, 0, -20);

    [self.view setBounds:newBounds];

}

I won't bother taking an image of the MainViewController.xib file's settings pane because I'm pretty sure they're made irrelevant by what I've set in info.plist? Let me know if I'm wrong about that.

My app supports rotation as well, in case that matters. And I'm using Cordova 2.1.0.


QUESTION

My HTML code is being cut off by 20px at the bottom because of what I added when trying to get iOS 7's status bar to display properly. If I'm at the bottom of the page in the app & I drag my finger to scroll down further, I can actually see the bottom of my page, but when I lift my finger it's still cut off by 20px (let me know if that makes no sense). What's wrong here? And how do I fix it? In iOS 6 and below, this is NOT an issue - everything is perfect.

Thanks!

有帮助吗?

解决方案

https://stackoverflow.com/a/19188984/706751

This is the best solution for people using PhoneGap who experience the iOS 7 Status Bar issue. If other solutions clip your content or don't do well with rotation, this is probably going to work for you!

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top