Serhii Didanov
Serhii Didanov

Reputation: 2348

swift splitViewController programmatically show master view

I have project with splitViewController as on image (iPhone version). enter image description here

On masterVC I have tableVC, on detailVC I have some information about items from masterVC. On detail VC I have a button. After touching this button I need go back to master view. If I do something like:

_ = navigationController?.popToRootViewController(animated: true)

It has no affect. How to go back on masterVC?

Upvotes: 1

Views: 1442

Answers (1)

lostInTransit
lostInTransit

Reputation: 71047

Calling popToRootViewController: in the detail viewcontroller will call it on the detailvc's navigation controller.

On the iPhone (assuming there's no split screen), if you want to dismiss the detail controller and go back to the master, you can do this

detailVC.navigationController?.navigationController?.popToRootViewController(animated: true)

Upvotes: 4

Related Questions