Reputation: 12215
I developed a static library for iPhone using a UINavigationController & pushing some UIViewControllers.
I'm implementing a way to permit ipad developers to include my library to their iPad applications. To do so, I want to display my library controllers in a UIPopoverController whose size is the iphone one.
That's I have developed, but each time i'm pushing a new viewController, the Popover resizes itself a very strange way:
I've checked my view controllers (via interface builder), and the AutoResize behaviors are deactivated.
Anybody have a solution ?
Upvotes: 3
Views: 1918
Reputation: 784
The accepted answer uses a method that is now deprecated in iOS 7.0.
I was having the same issue and had success using popoverContentSize.
Something along this below:
[_popoverSegue.popoverController setPopoverContentSize:CGSizeMake(320.0f, 460.0f)];
where _popoverSegue is an instance of UIStoryboardPopoverSegue
Hope this helps future visitors...
(sorry I should've probably commented to accepted answer but I don't have enough reputation...)
Upvotes: 0
Reputation: 405
The UIViewController
that the UIPopoverViewController
displays needs to set this property:
contentSizeForViewInPopover
to indicate its displaying size, and the UIPopoverViewController
will get resized according to the value of that property. For example:
- (void)viewDidLoad
{
[super viewDidLoad];
self.contentSizeForViewInPopover = self.view.frame.size;
// Do any additional setup after loading the view from its nib.
}
Upvotes: 4
Reputation: 7644
As far as I understand your problem, the popover resizes whenever you push a controller to the UINavigationController
, which is the root controller of your UIPopoverController
. I cannot say why this happens but you can get rid of it by sending a reference of your popoverController (popoverControllerReference
, you can create a singleton reference) to your view controller and manually setting the popoverContentSize
whenever you push controllers: popoverControllerReference.popoverContentSize = CGSizeMake(320, 460);
Upvotes: 0