![](/img/trans.png)
[英]Swift - Segue from UIViewController within NavigationController to UIViewController within TabBarController
[英]How to Segue from a NavigationController to a TabBarController without taking the Navbar with it in Swift 5?
我目前正在做一個小的 iOS 項目,遇到了一個問題:
該應用程序以用於登錄和注冊目的的Navigation View Controller
開始。 在此 NavigationVC 中的最后一個視圖控制器上完成注冊后,我想重定向到主Tab Bar Controller
。
問題是左側和右側之間缺少 segue。 來自 Xcode 的所有提議的 Segue 都不起作用。 modal Segue
是沒有選擇的,而show Segue
會使用 NavigationController 的 NavBar。
我希望你們對如何解決這個問題有想法。 提前感謝您的幫助。 祝你有美好的一天!
您可以簡單地通過以下方式彈出:
popToViewController:animated
或者
目標C:
[self.navigationController popToRootViewControllerAnimated:YES]
迅速:
self.navigationController?.dismiss(animated: true)
您可以重新考慮您的導航架構。
讓我們將 tabBarController 的第一個視圖控制器命名為“HomeViewController”
實現它的方法之一是:
您現在已經在 HomeViewController 之上展示了登錄過程。
注冊完成后,關閉 loginViewController。
您現在返回到 HomeViewController 並完成注冊。
此外,您可以使用 NotificationCenter 警告 HomeViewController 用戶剛剛登錄並執行任何初始工作。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.