0
votes

When presenting a ViewController modally with a storyboard segue, the previous ViewController bleeds through.

UIViewController B presents UIViewController C modally. Both of them have UIScrollView (if that matters). When I get to ViewController C, it's almost as though the the entire view is just a tiny bit smaller so that the previous ViewController bleeds through. It looks something like this:

1

The bottom light grey is part of the previous controller. The way I actually confirmed it was the previous view controller is I added this method to it:

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
   NSLog(@"I'm being touched!");
}

This only occurs in iOS 7 and not on iOS 8.

1
Perhaps your view on the second view controller does not fill the screen?shim
This question might help youLeonardo
@shim considering I am making everything in the interface builder... it seems unlikelyAudrey Hipburn
Does your view use autolayout constraints that pin the outer margins to the window edges?shim

1 Answers

1
votes

Well, turns out the reason this was occurring was because I had something similar to this in the appdelegate to get black status bars:

if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) {

    [application setStatusBarStyle:UIStatusBarStyleLightContent];
     [application setStatusBarHidden:NO withAnimation:UIStatusBarAnimationFade];

    self.window.clipsToBounds =YES;            
    self.window.frame =CGRectMake(0,20,self.window.frame.size.width,self.window.frame.size.height-20);
}

This was an issue because it was changing the entire window size. It wasn't causing an issue in the first view, but fo some reason it was causing an issue during modal segue's. So to fix it I changed it to something similar to:

if (IS_IOS7) {
        UIView *addStatusBar = [[UIView alloc] init];
        addStatusBar.frame = CGRectMake(0, 0, 320, 20);
        addStatusBar.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:1]; //You can give your own color pattern
        [self.window.rootViewController.view addSubview:addStatusBar];
    }

This method seemed to work better because instead of changing the window size, I was simply adding a UIView that was black to the top of the frame. This kept the window size the same and no more bleeding through.