I use code below to adjust view for adapt to statusBar on iOS7
- (void) adjustViewAdaptToiOS7 {
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) {
CGRect screen = [[UIScreen mainScreen] bounds];
if (self.navigationController) {
CGRect frame = self.navigationController.view.frame;
frame.origin.y = 20;
frame.size.height = screen.size.height - 20;
self.navigationController.view.frame = frame;
} else {
if ([self respondsToSelector: @selector(containerView)]) {
UIView *containerView = (UIView *)[self performSelector: @selector(containerView)];
CGRect frame = containerView.frame;
frame.origin.y = 20;
frame.size.height = screen.size.height - 20;
containerView.frame = frame;
} else {
CGRect frame = self.view.frame;
frame.origin.y = 20;
frame.size.height = screen.size.height - 20;
self.view.frame = frame;
}
}
}
}
it works well for pushViewController
[self.navigationController pushViewController :vViewController animated:true];
but for
presentModalViewController
[self presentModalViewController:vViewController animated:true];
there is no gap 20 pix on the top that adjust for statusBar/iOS7
even set ios6/7 deltas to -20/20, nothing help and works for me
Your comment welcome