2013-12-09 102 views
0

假設我有一個應用程序,啓動與UIViewController。但是,如果用戶按下該UIViewController上的按鈕,我希望應用程序切換到UITabBarController接口。UIViewController和UITabBarControllers與故事板

我在故事板中工作,我看不到創建這種設置?

+0

爲什麼你不能看到造成這種設置的? – preetam

+0

這不能做如下解釋,或者你可以嘗試通過初始化與UINavigationController,檢查我的答案在這裏** http://stackoverflow.com/questions/16351348/example-for-login-screen-modally-基於故事板/ 16351631#16351631 ** –

回答

4

儘管您可以添加tabBarController作爲另一個viewController的子項,但並不推薦使用 使用tabbarController的練習,您必須使用UITabBarController作爲rootViewController,即您的窗口的根。

由於類的UITabBarController從UIViewController類 繼承,標籤欄控制器具有 自己的觀點,即是通過視圖屬性進行訪問的一個標籤欄控制器的意見。當部署標籤欄界面的 時,必須將此視圖安裝爲窗口的根 。與其他視圖控制器不同,不應該將標籤欄界面 作爲另一個視圖控制器的子項安裝。

看一看:https://developer.apple.com/library/ios/documentation/uikit/reference/UITabBarController_Class/Reference/Reference.html

+0

顯然...在故事板上帶有根箭頭的viewController只是父母,其他孩子是相同的。它在數據結構中像樹一樣分層。 – preetam