Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove a navigation controller in storyboard?

I am following a simple swift tutorial that shows how to add a navigation controller to a viewcontroller in storyboards in xcode. This is done using Editor > Embed in > Navigation Controller

enter image description here

The problem is, once the navigation controller is embedded, it cannot be removed. The 'unembed' option is always greyed out. Removing the controller view from the storyboard results in an error. Even if the arrow indicating the first view is pointing to a simple empty view in exactly the same way as when you're starting a new project.

I would expect that there is still some code from the Navigation Controller lingering around somewhere, but how to pinpoint it?

like image 983
Kokodoko Avatar asked Jul 25 '14 11:07

Kokodoko


People also ask

How do I delete a navigation stack controller?

Use this code and enjoy: NSMutableArray *navigationArray = [[NSMutableArray alloc] initWithArray: self. navigationController. viewControllers]; // [navigationArray removeAllObjects]; // This is just for remove all view controller from navigation stack.

How do you remove objects from a storyboard?

You just select the label you want to delete, and hit the delete button on your keyboard. That will remove the object. It works for me. I use the delete back button!

How do I add a Viewcontroller to a storyboard?

To create a new view controller, select File->New->File and select a Cocoa Touch Class. Choose whether to create it with Swift or Objective-C and inherit from UIViewController . Don't create it with a xib (a separate Interface Builder file), as you will most likely add it to an existing storyboard.

What is a navigation controller?

NavController manages app navigation within a NavHost . Apps will generally obtain a controller directly from a host, or by using one of the utility methods on the Navigation class rather than create a controller directly. Navigation flows and destinations are determined by the navigation graph owned by the controller.


1 Answers

I follow this step.

1) select navigation controller and delete connection.

select navigation controller

2) make root view to your view controller

make root view

root view

like image 81
Max Avatar answered Oct 01 '22 09:10

Max