在我将导航控制器添加到故事板之前,该程序仍然有效。 在我将导航栏添加到项目后,当我从主页点击按钮时,它应该链接到第一页但是,它不能显示黑色背景。对于程序,我只是为视图控制器设置标题。有什么问题?我是否需要添加一些代码才能解决?
答案 0 :(得分:0)
首先,您需要确认自己是否在故事板上添加了NAVIGATION CONTROLLER或NAVIGATION BAR。如果您要将NAVIGATION CONTROLLER添加到VIEW CONTROLLER,您应该设置
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).
如果你遵循上述方法,你永远不会感到困惑。你可以得到相关答案。
现在,如果您要将NAVIGATION BAR添加到查看控制器,您只能看到以下内容
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
现在它将看到你需要的部分。