i am trying to perform segue from the last screen of navigation control (stack - where you can back) to the first screen of tab bar navigation. The only thing i success so far is to open the first screen of the tab bar without the bottom tabs and with back button on the top. any idea?
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
}
why you are doing with segue when you can done this work by set root view controller to the first view controller.
for ex:- at the end of the navigation screen you want to set first screen as a root view controller.
if your tabbar icon not appear then you can also create your tabbar vc identifer and set that controller as your current vc and it will work.
when you are on your last vc(View Controller) then use the navigation to push your vc.
let storyBoard = UIStoryboard(name: "Main", bundle: nil)
let vc: UIViewController =
storyBoard.instantiateViewController(withIdentifier: TabBarVC)
self.navigationController?.pushViewController(vc, animated: true)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.