我使用下面的代码调整视图以适应iOS7上的statusBar
- (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;
}
}
}
}
适用于pushViewController
[self.navigationController pushViewController :vViewController animated:true];
但是
presentModalViewController
[self presentModalViewController:vViewController animated:true];
顶部没有间隙20像素调整statusBar / iOS7
甚至将ios6 / 7增量设置为-20/20,没有任何帮助,对我有用
您的评论欢迎