I'm having some trouble with presenting a content view in a popover. I'm using the following code to set up the popover with a view controller which I instantiate from the storyboard. The view controller in which I'm presenting the popover is within a navigation controller :
MyViewController *viewController = [self.storyboard instantiateViewControllerWithIdentifier:@"MyViewController"];
viewController.contentSizeForViewInPopover = CGSizeMake(382, 502);
UIPopoverController *popover = [[UIPopoverController alloc]initWithContentViewController:viewController];
self.popoverController = popover; //self.popoverController is a private property of type UIPopoverController
[self.popoverController presentPopoverFromBarButtonItem:self.navigationItem.leftBarButtonItem permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
Here comes the problem: When I tap the left bar button the popover shows in the correct size with the correct content, but the content view is not resized to the size of the popover. Only the snippet of the content view which is "covered by the popover" is visible.
I'm having the same procedure with a table view, which is working perfectly-the table is fitted to the popover. I also tried to set the size of the popover controller itself, like it is suggested here. And I tried out some settings with the springs and struts of the affected view controller. But the outcome is always the same.
Now I really run out of ideas what I could try out, or what I'm possibly doing wrong/missing...HELP :(
Thanks in advance!
A TableView adjusts itself to the size of the container view controller it is put in. That is a feature of a UITableViewController. When you present the TableView by UIPopoverController, the popover determines the size for the table.
This mechanism does not work for all views, so you need to set the size of your view itself as well.