I have a Show
type UIStoryboardSegue
with abSegue
identifier. It navigates from UIViewController A
to B
.
In the entire application I use custom UINavigationController which works perfectly fine, but here it doesn't.
Using self.performSegue(id: "abSegue", sender: self)
causes loss of the UINavigationController
, but using
let controller = UIStoryboard(name: "Storyboard", bundle: bundle).instantiateViewController(withIdentifier: "B")
navigationController?.pushViewController(controller)
works fine and I receive expected UINavigationController
.
What can cause that behaviour?
Segues are a visual way to connect various components on your storyboard, but sometimes it's important to be able to trigger them programmatically as well as after a user interaction.
Segues are visual connectors between view controllers in your storyboards, shown as lines between the two controllers. They allow you to present one view controller from another, optionally using adaptive presentation so iPads behave one way while iPhones behave another.
Segue identifiers are plain strings. They are useful if we need to invoke the segue programmatically because they identify the segue. But in general, identifiers are used to pass information from one view controller to another.
Use
self.performSegue(withIdentifier: segueID, sender: self)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With