![](/img/trans.png)
[英]Perform segue to another Navigation Controller without showing Tab Bar
[英]Perform segue from navigation control to tab bar navigation swift4
我正在嘗試從導航控件的最后一個屏幕(堆棧 - 您可以返回的位置)執行 segue 到選項卡欄導航的第一個屏幕。 到目前為止,我唯一成功的是打開標簽欄的第一個屏幕,沒有底部標簽,頂部有后退按鈕。 任何的想法?
func userLogin(status: Bool, user: UserModel) {
DispatchQueue.main.async {
if status == true{
self.userModel = user
self.performSegue(withIdentifier: Constants.gotoOverview, sender: self)
} else {
let alert = UIAlertController(title: "Register", message: "some message", preferredStyle: UIAlertController.Style.alert)
alert.addAction(UIAlertAction(title: "OK", style: UIAlertAction.Style.default, handler: nil))
self.present(alert, animated: true, completion: nil)
}
}
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
let vc = segue.destination as! OverviewController
vc.userModel = userModel
}
當您可以通過將根視圖控制器設置為第一個視圖控制器來完成這項工作時,您為什么要使用 segue。
例如:- 在導航屏幕的末尾,您希望將第一個屏幕設置為根視圖控制器。
如果您的標簽欄圖標沒有出現,那么您還可以創建您的標簽欄 vc 標識符並將該控制器設置為您當前的 vc,它會起作用。
當您在最后一個 vc(視圖控制器)上時,然后使用導航推送您的 vc。
let storyBoard = UIStoryboard(name: "Main", bundle: nil)
let vc: UIViewController =
storyBoard.instantiateViewController(withIdentifier: TabBarVC)
self.navigationController?.pushViewController(vc, animated: true)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.