Skip to content

Instantly share code, notes, and snippets.

@hanshsieh
Last active August 29, 2015 14:24
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 hanshsieh/b97dd950ce2b7441187b to your computer and use it in GitHub Desktop.
Save hanshsieh/b97dd950ce2b7441187b to your computer and use it in GitHub Desktop.
Fix the problem that status bar overlaps the view
@implementation MyViewController
- (void)viewWillAppear:(BOOL)animated {
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) {
CGRect viewBounds = [self.view bounds];
viewBounds.origin.y = 18;
viewBounds.size.height = viewBounds.size.height - 18;
self.view.frame = viewBounds;
}
// Some other code...
[super viewWillAppear:animated];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment