Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

preferredContentSize does not shrink

Tags:

xcode

ios7

I use UIPopoverController to popover a window. I use preferredContentSize to set the size. Then, I use Push a new view controller with larger size. When the child view pop up, I like to recover the window to original size. But seems not work.

I already put the self.preferredContentSize = myWindowSize; But it seems can not recover.

In iOS6 or before, I set the contentSizeForViewInPopover to CGSizeZero, then set the proper size. But on iOS7, it will make the popup disappear.

like image 479
Jonathan Lee Avatar asked Sep 22 '13 08:09

Jonathan Lee


1 Answers

This solved it for me:

override func viewDidAppear(animated: Bool)
{
    navigationController?.preferredContentSize = preferredContentSize
    super.viewDidAppear(animated)
}
like image 79
Dan Selig Avatar answered Sep 28 '22 10:09

Dan Selig