簡體   English   中英

presentViewController不顯示選項卡欄或導航欄

[英]presentViewController does not show Tab Bar or Navigation Bar

我是Swift的新手,已經為此苦苦掙扎了一段時間。

我試圖根據登錄狀態將用戶重定向到“登錄”視圖控制器或“主頁”視圖控制器。

“主頁”視圖控制器具有NavigationBar和TabBar,並顯示一個表。 但是,當我使用以下代碼時,我只能看到表格。 完全不顯示NavigationBar和TabBar。

var view = self.storyboard?.instantiateViewControllerWithIdentifier("HomeViewController") as UIViewController
self.presentViewController(view, animated: true, completion: nil)

這是我的故事板: https : //www.dropbox.com/s/dkcz45n8000gua6/storyboard.png? dl =0

任何幫助,將不勝感激!

編輯(使用的TabBarController):

var view = self.storyboard?.instantiateViewControllerWithIdentifier("MainTabController") as UITabBarController
self.presentViewController(view, animated: true, completion: nil)

您的問題與迅速適應無關。 這與不了解情節提要有關。 如果實例化HomeViewController並顯示它,那么您將獲得全部。 您剛剛實例化的裸控制器並不知道它嵌入在情節提要中的選項卡欄控制器和導航控制器中。 您應該改為實例化選項卡欄控制器,並顯示它。 它將實例化其任何子級,導航控制器將實例化其根視圖控制器。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM