iOS7 statusBar适用于presentModalViewController

时间:2014-03-02 14:17:19

标签: ios ios7 ios7-statusbar

我使用下面的代码调整视图以适应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];

enter image description here

但是

presentModalViewController

[self  presentModalViewController:vViewController animated:true];

顶部没有间隙20像素调整statusBar / iOS7

甚至将ios6 / 7增量设置为-20/20,没有任何帮助,对我有用

您的评论欢迎

enter image description here

0 个答案:

没有答案