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
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?
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.
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!
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.
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.
I follow this step.
1) select navigation controller and delete connection.
2) make root view to your view controller
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With