1
votes

My app presents a view controller inside a UIPopoverController when the user presses a button. On iOS7 this works fine, but on the iOS8 beta the top of the view controller is underneath the popover's navigation bar. You can see the difference in the screenshots below.

I've made a really simple app that shows the problem. There's one button connected to the method shown below. contents is a very simple view controller with a yellow background and two labels in it. thePopoverController is a UIPopoverController.

- (IBAction)go:(id)sender {

    self.contents = [[ContentsViewController alloc] init];

    UINavigationController *navController = [[UINavigationController alloc]initWithRootViewController:self.contents];
    self.thePopoverController = [[UIPopoverController alloc] initWithContentViewController:navController];

    [self.thePopoverController presentPopoverFromRect:self.view.frame inView:self.view permittedArrowDirections:0 animated:TRUE];
}

Does anyone know why this happens on iOS8? Is there a way of getting it to work on iOS7 and 8, without having to hard-coded an offset? Any help much appreciated!

Cheers

Screenshot on iOS7

Screenshot on iOS8

1

1 Answers

0
votes

I had this issue and removing UIRectEdgeTop from my view controller's edgesForExtendedLayout mask fixed it for me. So after setting self.contents, do this:

self.contents.edgesForExtendedLayout = UIRectEdgeLeft | UIRectEdgeBottom | UIRectEdgeRight;