Skip to content

Instantly share code, notes, and snippets.

@seanmtracey
Created August 26, 2014 20:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seanmtracey/0bcf29495b53b571560c to your computer and use it in GitHub Desktop.
Save seanmtracey/0bcf29495b53b571560c to your computer and use it in GitHub Desktop.
A tiny fix for having content display beneath status bar in Cordova on iOS 7
//Code found at http://stackoverflow.com/questions/19209781/ios-7-status-bar-with-phonegap
- (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 = 20;
viewBounds.size.height = viewBounds.size.height - 20;
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