Summary:
The use of storyboard with the original single xib file is still somewhat different, in the habit of some discrepancy. Write down the key points you are experiencing here.
1. Set the first Viewcontroller to Navigationcontroller property
Typically when you create a new project. Comes with a Viewcontroller class. Storyboard also has a ready-made view bound to it, unlike in the past, there is no code in appdelegate that directly sets the view controller as the root view. If you want to set this view controller to a Navigationcontroller and push other sub-interfaces, use the following method:
In the storyboard file. New drag out a navigationcontroller, placed on the left side of the original view, after releasing the mouse, there will be two views, the middle of the arrow connected, now delete the arrows pointed to the view, the arrows point to our original view, In the left sidebar you can see the new Nacigationcontrollerscene root view (root view Controller) that points to our view.
Then don't forget to point the arrows that represent the original interface to the Navigationcontroller we dragged out so that our view has the properties of Navigationcontroller.
2. Call the controller that is bound to the view in storyboard
We create a new view in the storyboard and then associate it with a controller, and we assume that we want to invoke the display of the interface. It is not possible to create an instance of the controller using the traditional method and then show it. This will only show what the code in the controller has written. The content set in storyboard is not displayed, and most obviously the background of the view is black. The following methods should be used:
We have to find view! through storyboard. Uistoryboard *storyboard = [Uistoryboard storyboardwithname:@ "Main" bundle:nil]; Nextviewcontroller *NEXTVC = [Storyboard instantiateviewcontrollerwithidentifier:@ "Nextviewcontroller"]; [Self.navigationcontroller PUSHVIEWCONTROLLER:NEXTVC Animated:yes];
Don't forget to define the view's identifier in the view properties in storyboard, that is, the code above finds the view's credentials.
Constantly updated ...
Reprint please indicate the source, thank you
Storyboard use key records in iOS