Question

Before I added the navigation controller to storyboard, the program still worked. After I added the navigation bar to project, when I clicked the button from the homepage,it is supposed to link to the first page but, it can't and displays the black background. For the program, I just set the title for the view controller. What's the problem? Should I need to add some code to solve?

Was it helpful?

Solution

First you need to confirm yourself whether your are adding NAVIGATION CONTROLLER or NAVIGATION BAR to storyboard.If you are going to add NAVIGATION CONTROLLER TO VIEW CONTROLLER,you should set

            1.PUT NAVIGATION CONTROLLER IN STORYBOARD(FROM UTILITY AREA)
            2.WHEN YOU DRAG THE NAVIGATION CONTROLLER(FROM UTILITY AREA),SIMULTANEOUSLY YOU WILL HAVE A TABLE VIEW CONTROLLER WITH NAVIGATION CONTROLLER.
            3.ONCE YOU PUT IN STORYBOARD,YOU SHOULD CLICK TABLE VIEW CONTROLLER AND DELETE THE TABLE VIEW CONTROLLER.
            4.CONNECT NAVIGATION CONTROLLER WITH VIEW CONTROLLER(YOU SHOULD GIVE RELATIONSHIP AS ROOT).

If u follow above methods,you will never get confused.You can get relevant answer.

And now if you are going to add NAVIGATION BAR TO VIEW CONTROLLER YOU JUST SEE the following things

            1.After the above process ADD NAVIGATION BAR IN VIEW CONTROLLER PART(HEADER OF THE VIEW CONTROLLER)
            2.GIVE TITLE(WHATEVER YOU WANT) IN THE MIDDLE OF THE NAVIGATION BAR

Now it will see your required part.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top