目前为止,添加导航栏的方式有三种:
1.直接拖NavigationController视图控制器;
2.直接拖NavigationBar控件;
3.如果先拖的是ViewController或者TableViewController然后嵌入NavigationController,具体步骤是选择视图控制器点Editor-Emeded-NavigationController;
但是三种方法有区别,第一种方法需要自己添加NavigationItem,而后面两种方法自带就有NavigationItem,可以直接直接设置title属性,以及添加Bar Button Item.