When presenting an UINavigationController
within an UIPopoverController
I let the popup know its size. So given we are within any UIViewController
that shall display the popup we would do:
MYNavigationController *fooController = [self.storyboard instantiateViewControllerWithIdentifier:@"fooController"];
self.popover = [[UIPopoverController alloc] initWithContentViewController:fooController];
self.popover.popoverContentSize = CGSizeMake(600, 400);
[self.popover presentPopoverFromRect:CGRectMake(0, 0, 0, 0) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
However, when I push another UIViewController
on top of fooController
that pushed view controller will change the popover's size. I did not force any content size change programmatically. That view controller is not calling self.contentSizeForViewInPopover = CGSizeMake(400, 300);
as I really would like to avoid to let all view controllers know that they are within a popover controller. This might be also the reason that this method is even deprecated from iOS 7 on. There's another property called preferredContentSize
that is available only for iOS 7, however this also does change the popover's content size.
So my questions are:
Why does the popover's content size change?
Why does the UIPopoverController have a
popoverContentSize
property when pushed view controllers automatically overwrite this size - without me as the programmer doing nothing?How can I prevent the pushed view controller from changing its content size?