简体   繁体   中英

Which segue should I use to show a view controller vertically?

First and foremost i'm still new to Swift so please bear with me. Say i'm at view controller A (which is the root view controller in the navigation hierarchy) and I want view controller B to appear as a popup (cover the entire screen). I want that popup and to remain part of the navigation hierarchy. Then from that popup push to view controller C with a horizontal transition. How would I do this? I am using segues. I just don't know which segue to use. Should I use a modal or popover segue to go from view controller A to view controller B? Or should I simply use a push segue and use a custom transition? I'd prefer not to use a custom transition but let me know what you think.

将ViewController B嵌入到导航控制器中,然后模态显示导航控制器。

Use the below code to present the VC from bottom.

let alertVC = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "CustomAlertViewController") as! CustomAlertViewController

alertVC.modalPresentationStyle = UIModalPresentationStyle.overCurrentContext

self.present(alertVC, animated: true, completion: nil)

Then further use push for other VC's

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