1

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?

GoldenJoe
  • 7,464
  • 6
  • 49
  • 85

1 Answers1

0

Check out this post: How to force a UIViewController to Portrait orientation in iOS 6

Community
  • 1
  • 1
danielM
  • 2,404
  • 2
  • 19
  • 21
  • Sorry, I think I found another post that might help you solve this issue. See the link above. – danielM Oct 31 '12 at 14:51
  • Thanks for the help, but that's not it either. Basically, the view should handle any orientation. The disconnect I'm having is that when I add a new UIViewController to the [window rootViewController] hierarchy, the new controller isn't aware of the existing rotation, and will assume portrait by default. If you rotate the device after it is added, it will correctly assume the new orientation, but for whatever reason, iOS doesn't seem to notify controllers about the current orientation of the device when they are initially added. – GoldenJoe Oct 31 '12 at 17:34