Navigation Controller Views
A navigation controller is a container view controller—that is, it embeds the content of other view controllers inside of itself. You access a navigation controller’s view from its view property. This view incorporates the navigation bar, an optional toolbar, and the content view corresponding to the topmost view controller. Figure 3 shows how these views are assembled to present the overall navigation interface. (In this figure, the navigation interface is further embedded inside a tab bar interface.) Although the content of the navigation bar and toolbar views changes, the views themselves do not. The only view that actually changes is the custom content view provided by the topmost view controller on the navigation stack.

以上是從官方文檔copy過來的,大致意思就是導(dǎo)航控制器是一個容器視圖控制器,這個容器是以 棧 的形式管理的
我們以這種方式的跳轉(zhuǎn)像pop push 等就非常容易理解了,初始化的時候rootViewController也就很容易理解了
文檔中個人覺得需要注意的地方:
The navigation controller manages the creation, configuration, and display of the navigation bar and optional navigation toolbar. It is permissible to customize the navigation bar’s appearance-related properties but you must never change its frame, bounds, or alpha values directly. If you subclass UINavigationBar, you must initialize your navigation controller using the initWithNavigationBarClass:toolbarClass: method. To hide or show the navigation bar, use the navigationBarHidden property or setNavigationBarHidden:animated: method.
翻譯:導(dǎo)航控制器管理創(chuàng)建,配置和導(dǎo)航欄和可選的導(dǎo)航工具欄的顯示。它允許自定義導(dǎo)航欄的外觀相關(guān)的屬性,但你絕不能直接改變它的框架,邊界,或alpha值。 方法如果你繼承UINavigationBar的,則必須使用initWithNavigationBarClass初始化導(dǎo)航控制器。要隱藏或顯示導(dǎo)航欄,使用navigationBarHidden屬性或setNavigationBarHidden :動畫:方法。
下面講解一下自定義導(dǎo)航欄 navigationBar 的外觀
先上效果圖(仿微信的)

直接上代碼:(注釋還是比較清晰的)
// 獲取navigationBar
UINavigationBar *bar = [UINavigationBar appearance];
CGFloat rgb = 0.1;
// bar tint color
bar.barTintColor = [UIColor colorWithRed:rgb green:rgb blue:rgb alpha:0.9];
// tint color
bar.tintColor = [UIColor whiteColor];
// 設(shè)置title前景色
bar.titleTextAttributes = @{NSForegroundColorAttributeName : [UIColor whiteColor]};
// barStyle樣式蘋果推薦了兩種
// bar.barStyle = UIBarStyleBlack;
// 設(shè)置bar的透明度
// bar.translucent = NO;
// 取消bar下面的分割線,
bar.shadowImage = [UIImage new];
// 還原bar下面的分割線,設(shè)為nil就還原了,神奇吧\(^o^)/~
// bar.shadowImage = nil;
// 可以設(shè)置背景圖片
// [self.navigationBar setBackgroundImage:navBgImg forBarMetrics:UIBarMetricsDefault];
當然也可以自定義一個navigationController,然后去設(shè)置其navigationBar的外觀
注意:
個人建議,如果沒有特殊需求,項目中就用同一個navigationController,畢竟就是一個容器的作用。(被坑過的人,你們懂得)
tabbar的外觀修改可以類比navigationbar,也是一個容器
希望會給大家?guī)韼椭鶲(∩_∩)O