Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Perform segue loses Navigation Controller

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?

like image 698
kkiermasz Avatar asked Aug 14 '18 14:08

kkiermasz


People also ask

What is perform segue?

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.

What is a segue in ios?

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.

What is segue identifier?

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.


1 Answers

Use

self.performSegue(withIdentifier: segueID, sender: self)
like image 179
Vyacheslav Avatar answered Sep 28 '22 07:09

Vyacheslav