1

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];

enter image description here

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

enter image description here

arachide
  • 8,006
  • 18
  • 71
  • 134
  • Your example screen is showing a navigationbar on the ModalViewController but your code is not showing where this bar is coming from. If your ViewController is having a containerView but gets a navigationBar from somewhere that is not subview of containerView it would be a possible reason. – Christian Mar 02 '14 at 21:09
  • http://stackoverflow.com/questions/18775874/ios-7-status-bar-overlaps-the-view/20759093#20759093 – Darshit Shah Mar 03 '14 at 12:36

0 Answers0