Hi all.
In IB I have dragged a Container View from the object palette to my View Controller ("MainViewController").
I have control-dragged from the Container View to a second View Controller ("EmbeddedViewController"), creating an Embed Segue.
The contents of EmbeddedViewController's view property are subject to change (subviews will be added/removed over time).
Question: how do I make MainViewController dynamically adjust in size to size changes in EmbeddedViewController?
Do I need to do something like add a height Constraint Outlet to MainViewController, and set its constant when the size of EmbeddedViewController changes?
Or is there a simpler way that can be done in IB?
Thanks for any help.
Hi SuperWomble,
There is no way to make the resizing happen automatically; you will need some code. If the child view controller updates its preferredContentSize, in response to subviews being added/removed, then the parent view controller (your container) will receive call to its -preferredContentSizeDidChangeForChildContentContainer: method. You can use this opportunity to adjust the height of the Container View.