I have a popover containing a UINavigationController. I can display the popover fine, and it contains the navController just fine. The navController contains a tableView a
There are two ways to set the contentSizeForViewInPopover in the storyboard. You can set your view controllers that are with your navigation controller, to FreeForm and set the root views to the desired size. Or, you can keep the simulated metric as inferred and check "Use Explicit Size" and set the size you want there.
Then, in each view controller that is within your navigation controller, add the following...
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
["yourpopoverController" setPopoverContentSize:CGSizeMake(self.
contentSizeForViewInPopover.width, seld.contentSizeForViewInPopover.height + self.
navigationController.navigationBar.frame.size.height) animated:YES];
}
In the transition animation, the new view will come in aligned with the top, and then the height will be adjusted accordingly.
This way, you don't have to override contentSizeForViewInPopover, or specify some other size specifically in your view controllers. It's all in the storyboard.
If one of your view controllers has a variable height, then you do need to override contentSizeForViewInPopover in that view like so...
- (CGSize)contentSizeForViewInPopover {
return CGSizeMake(450, "calculate your height here");
}