Cris
Cris

Reputation: 12194

How can i define a NavigationController that embeds a ViewController?

I have seen a project with the following storyboard:

http://www.disclafani.org/vc.png

I would like to know how it has been built the CustomerPagesViewController as NavigationController, i don't see a RootNavigationController for it.

In short terms ... how can i define a UINavigationController that embeds a ViewController?

Upvotes: 0

Views: 761

Answers (1)

tiguero
tiguero

Reputation: 11537

When you drag and drop a navigation controller in storyboard, it will create two controllers (two scenes to be more precise): a navigationbar controller and a tableview controller that will be defined as your rootview controller. All you have to do is replace your tableview controller by your custom controller: it will be embedded in your navigation controller.

EDIT Sorry I think i mislead you in my first answer: it doesn't look like you can simply replace one controller by another. If you want a custom view controller embedded in a navigation controller a better approach would be:

  1. Drag and drop a view controller on storyboard
  2. Reference your custom view controller by editing the custom class field in the identity inspector
  3. Drag and drop a navigation controller on storyboard
  4. select your custom view controller and select from editor the embed in option by choosing navigation controller: your navigation controller should now contains your view controller. You can deleted the tableview controller that was created when you drag and drop the navigation bar controller.

Upvotes: 1

Related Questions