Pergunta

I am confused.. I have implemented two separate UIViewControllers - one main VC which is for portrait mode (PortraitVC), and one for landscape mode (LandScapeVC). This is following Apple's "Alternate Views" example in the documentation.

  1. I display PortraitVC
  2. I tap a button which displays a UINavigationController, onto which is pushed a UITableViewController
  3. I rotate the UITableViewController to landscape orientation
  4. I press 'Done' to pop the UITableViewController and UINavigationController
  5. BUT.. in my hierarchy, I then see the PortraitVC when my device is still in landscape orientation

What I want to do is somehow remove the PortraitVC from the hierarchy and replace with LandscapeVC so when the UINavigationController dismisses, it animates back to LandscapeVC instead.

How do I replace PortraitVC with LandscapeVC prior to dismissing the UINavigationController please?

Note my root view controller is either the PortraitVC or LandscapeVC which is a custom display - so I don't derive these from UINavigationController. Its only when I tap an image on my root view controller (e.g. setttings button) that I want to start a chain of drill-down UITableViewControllers and need the UINavigationController to take care of "Back" buttons etc.

Foi útil?

Solução

Somebody kindly responded to my post on the Apple Dev forum. I have successfully implemented a solution using a container view controller with a portrait and landscape child view controller(s). Works fine.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top