The iPad app that I'm working on makes use of Storyboards and segues. I'm trying to display a different view controller when the user clicks on different cells in the master view. After referring to different tutorials, the steps that were taken were -
Storyboard
, Master View Controller
, created static cells for the table view and added 3 different rows (i.e. cell 1, cell 2, cell 3)View Controller
, selected it and attached a Navigation Controller
to it (Editor
-> Embed In
-> Navigation Controller
)Master View
, I did a ctrl-click on the Navigation Controller
.Segue Style
"Replace" and Destination
"Detail Split"The result that I see is the detail view gets replaced.
But the navigation bar does not have the bar button item Master
.
So I'm unable to click the Master
button which would show the table containing cells from where I can navigate to a different view.
I've already read many blogs and seen commentary which talk about replacing a segue for similar problems. However nobody seems to have faced this specific issue while using storyboards and segues.
From my understanding using segues should help me achieve what I want. From those who have tried this approach, any pointers in the right direction will be helpful.
Use any element to open the dropdown menu, e.g. a <button>, <a> or <p> element. Use a container element (like <div>) to create the dropdown menu and add the dropdown links inside it. Wrap a <div> element around the button and the <div> to position the dropdown menu correctly with CSS.
To dismiss a modally presented view controller, call the view controller's dismiss(animated:completion:) method.
Try changing the Segue Style
from Replace
to Push
. It should resolve your problem.
When you push a UIViewController
on a UINavigationController
, it will be added to a stack and you will be able to navigate back :
Your navigation controller stack before tapping "Detail":
Master
Your navigation controller after tapping detail and navigating a little more ...:
Master -> Detail (Navigation button is displayed) -> Some other details (Navigation button is displayed) -> And maybe some more (Navigation button is displayed)
When you call a new segue using Replace
like you did, the Master
will be replaced with Detail
, and you will not be able to navigate back because Master was replaced and it's not on the stack anymore.
Your navigation controller stack before tapping "Detail":
Master
Your navigation controller after tapping detail using replace like you did:
Detail (no navigation button because master was replaced and we don't have nothing more on the stack)
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