Search code examples
ios7uinavigationbarxcode5framestatusbar

iOS 7 Retina Display Cuts top portion of Navigation Bar


iOS 7 Retina Display Cuts top portion of Navigation Bar after simply viewing a YouTube video or go to a URL that streams music. The Navigation Bar remains cut of at the top through out the app. Almost looks like a thin black bar or a gap that cuts a small portion at the top and the best way I can explain it is if you see a navigation bar at the top of a an app, imagine that the top half of it is black.

Little info about Status bar in the app: Status bar is initially hidden YES View controller-based status bar appearance NO Using Auto Layout

I would appreciate any help as this is really frustrating.


Solution

  • This solved the issue:

    -(void)viewWillLayoutSubviews {
        if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) {
            self.view.clipsToBounds = YES;
            CGRect screenRect = [[UIScreen mainScreen] bounds];
            CGFloat screenHeight = screenRect.size.height;
            self.view.frame =  CGRectMake(0, 20, self.view.frame.size.width,screenHeight-20);
            self.view.bounds = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
        }
    }