Skip to content

Instantly share code, notes, and snippets.

@jonkiddy
Created September 4, 2014 20:24
Show Gist options
  • Save jonkiddy/e830ce2f525ba5169114 to your computer and use it in GitHub Desktop.
Save jonkiddy/e830ce2f525ba5169114 to your computer and use it in GitHub Desktop.
Controlling top bar in Phonegap app.
In MainViewController.m inside: - (void)viewWillAppear:(BOOL)animated add this:
//Lower screen 20px on ios 7
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) {
CGRect viewBounds = [self.webView bounds];
viewBounds.origin.y = 18;
viewBounds.size.height = viewBounds.size.height - 18;
self.webView.frame = viewBounds;
}
so the end function will look like this:
- (void)viewWillAppear:(BOOL)animated
{
// View defaults to full size. If you want to customize the view's size, or its subviews (e.g. webView),
// you can do so here.
//Lower screen 20px on ios 7
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) {
CGRect viewBounds = [self.webView bounds];
viewBounds.origin.y = 18;
viewBounds.size.height = viewBounds.size.height - 18;
self.webView.frame = viewBounds;
}
[super viewWillAppear:animated];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment