1
votes

I have an app which has two main controllers: A GJClientSelectionController, which is just a regular UIViewController with a view containing a scrollview, and a CGClientDetailController, which is a custom UIViewController that manages a custom tab bar and a controller for each one. I switch between the controllers as the user moves between each part of the app.

The problem is, I'm not sure what the correct design pattern is. Until iOS6, I was just setting each one as the value of the window's rootViewController property. It worked well, but if the device is rotated and then I switch controllers, the newly visible controller will not have received the rotation notification and will be drawn wrong until the user rotates the device. I'm also experimenting with having a regular UIViewController that I call masterController, and setting that as the rootViewController, then adding the other two controllers as childViewControllers. The only thing is that if I make the view for the childViewController hidden, it still misses rotation notifications.

What's the right design pattern for moving between UIViewControllers? How can I ensure that a controller and its view has the correct orientation when I switch to them?

1

1 Answers