简体   繁体   中英

How can I switch from one view controller screen to another in different navigation stacks in my Xcode Swift project?

I have a tab bar controller with 5 tabs and each tab is initialised with its own navigation controller and thus its own stack. How do I navigate from one view controller on one stack to another view controller on another stack? I have tried using the view controller method present(...) but I think I should be popping and pushing view controllers but I don't know how to achieve that. Do I have to pop and push via the tab bar controller somehow?

Your Question is not clear enogh here is a solution what i think you are looking for

let storyboard = UIStoryboard(name: "Main", bundle: nil)
            let controller = storyboard.instantiateViewController(withIdentifier: "MallDetailVC") as! MallDetailVC
            controller.modalPresentationStyle = .fullScreen
            self.present(controller, animated: true, completion: nil)

All you have to do is assign the class name as storyboard ID in Inerface Builder/StoryBoard

if not please ask your question with more details and put some code so we can be in a better situation to answer you

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM