Consider a container view controller with two child view controllers (A and B), both added with addChildViewController:. Then:
A.viewis added to the container view- B is displayed by doing
transitionFromViewControllerfrom A to B. B receivesviewWillLayoutSubviewsand all is good with the world. - The device rotates while displaying B. Only B receives the rotation calls (
willRotateToInterfaceOrientation:et all). - A is displayed by doing
transitionFromViewControllerfrom B to A. A doesn’t receiveviewWillLayoutSubviewsand thus the layout is broken.
Is this the expected behavior? If not, what might I be doing wrong? If yes, what should I do to notify A of the rotation change while displaying B?
As soon as you call
addChildViewController:you are now a View Controller Container Implementer. This means you do have to do a little more work than a standard presentation call likepresentViewController... This includes dealing with the frames of the views of the controllers you add as children, as your question suggests you might have expected.For example, to implement a super basic example container, that just shows each child full screen, you could do something like this.