Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change height of the popoverController when one of its viewControllers gets popped?

Tags:

iphone

I have a SplitViewController based app. It uses a rootViewController inside a popoverController. The rootViewController sets the height of the popover by specifying (in viewDidLoad)

self.contentSizeForViewInPopover = CGSizeMake(320.0, 573.0);

When you select a row in the rootViewController, it pushes a secondViewController. The secondViewController makes the popover taller by specifying (in viewDidLoad):

self.contentSizeForViewInPopover = CGSizeMake(320.0, 900.0);

When the user taps on the back button to pop the secondViewController, the height of the popover stays taller. I would like to adjust the height back to the original size. I tried setting contentSizeForViewInPopover in viewWillAppear and also in navigationController's willShowViewController delegate methods. But these did not have any effect.

like image 389
Vic Avatar asked Dec 23 '22 03:12

Vic


1 Answers

FWIW, I worked around this problem by manually resizing the popoverController in my view's viewWillAppear method. In other words, I set self.contentSizeForViewInPopover in -[viewDidLoad] and set popoverController.popoverContentSize in -[viewWillAppear:]. Of course, this requires that you save a pointer to the popoverController.

like image 168
Roberto Avatar answered May 19 '23 03:05

Roberto