1.打開Main.storyboard,將Navigation Controller控件拉到空白處。
2.若不需要使用系統自動提供的Root View Controller作爲根視圖,可將Root View Controller刪除,並將View Controller的開始箭頭拖動到Navigation Controller的左邊
PS:也可以從右邊屬性爛更改,控制處如下:
3.指定Navigation Controller的根視圖。
4.根視圖View Controller會自動生成一個Navigation item控件。
5.導航條作用兩側的按鈕需要手動將Bar Button item控件拉到導航條的兩側。
6.新拉入的View Controller是空白的,與根視圖進行跳轉關聯後還需要手動拖入Navigation item控件。
1)拉入新View Controller
2)建立跳轉關聯
3)手動拖入Navigation item控件
7.運行結果如下: