Tab Bar 即是在 iPhone 下方的功能選項列表。有 2 個方式製作 Tab Bar: (1) 在 View Controller 上拖曳一個 Tab Bar Controller 元件 (2) 直接使用 Apple 已寫好的 Template, 即 Tabbed Application。 使用 Tab Bar 好處是無論 View 如何透過 Segue 切換,它都被顯示。 我們把 Tab Bar Controller 當成 Container,此 Container 已嵌入一個 Tab Bar 元件。所有被放在此 Container 的 View 屬於 Layer 1,但, Tab Bar 卻屬於 Layer 2。因此,View 無論如何切換,Tab Bar 永遠顯示在最上層。這概念與 Photoshop 的塗層 layer 概念相同。 Tab Bar Controller 是個非常特殊的 Container。若我們新增一個 View Controller 到此 Tab Bar Controller 中, 其嵌入的Tab Bar 元件就會新增一個 Button 與此 View Controller 呼應。也就是說,每個 Tab Bar 上的 Button 都會指向一個特定的 View Controller。 Tab Bar 上的 Button 的圖示 icon 可透過 Feature 這屬性客製化。 參考: 1. UITabBarController,https://developer.apple.com/library/prerelease/ios/documentation/UIKit/Reference/UITabBarController_Class/ 2. Tab Bar Controllers,https://developer.apple.com/library/ios/documentation/WindowsViews/Conceptual/ViewControllerCatalog/Chapters/TabBarControllers.html
prettyprint
2015年10月14日 星期三
Tab Bar Controller
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言