views:

56

answers:

1

This is the structure of my application currently:

  • UIWindow
    • UIViewController (Root View Controller)
      • UINavigationController
      • UITableView
    • UIViewController (PresentModalViewControllerAnimated:YES)
      • UITableView

This is how I want it to be:

  • UIWindow
    • UIViewController (Root View Controller)
      • UINavigationController
      • UITableView
    • UIViewController (PresentModalViewControllerAnimated:YES)
      • UINavigationController
      • UITableView

I have a view that slides up and I want that view to have its own UINavigationController. It's for the app settings so I want to have nested options.

Any ideas how to do this?

The application type was a Navigation app to start with which is where the Root View Controller's UINavigationController came from.

+1  A: 

Note that UINavigationController inherits from UIViewController so you can present it as a modal view controller. I've created a simple test application and this approach worked fine.

To present navigation controller:

ChildController* controller = [[ChildController alloc] initWithNibName:@"childController" bundle:nil];
UINavigationController* childNav = [[UINavigationController alloc] initWithRootViewController:controller];
[self presentModalViewController:childNav animated:YES];    
[controller release];
[childNav release];

Then to dismiss modal controller from whatever controller in its hierarchy use

[self.navigationController dismissModalViewControllerAnimated:YES];
Vladimir
Thanks so much!!
tarnfeld