I've just started learning Swift and Xcode, so I apologise in advance if my question is confusing or missing information. Please let me know if that's the case.
My question is on the automatic navigation bar created when I embed my scenes in the navigation controller.
As I've tried to show in my screenshot in the link below, my idea is to use the "Refusion" button in scene 1 to show scene 2. This works. However, scene 2 does not generate an automatic back button this way, which is what I'm trying to get.
If I create a button in scene 2 that shows scene 1 upon being pressed, scene 1 will now have an automatically generated back button. But this sends the user/me back from scene 1 to scene 2.. Which I already have my "Refusion" button for and also it just creates a confusing loop.
So, my question is: I'm trying to figure out how to get the auto-back button on my scene 2 and just scene 2, how do I do that? I'm probably doing something wrong, but would appreciate any help in where my error is.
I've embedded both scenes in the navigation controller.
Thanks,
You need to embed only scene 1
in navigation controller
.
When you tap on Refusion
button, push scene 2
. Scene
2 then will be added in the navigation stack
. In this case default back button
will appear on the navigation bar
.
In case you present scene 2
from scene 1
, back button
won't appear on the navigation bar
. i.e. scene 2
won't be added in the navigation stack
.
Back button
on navigation bar
only appear on the controllers that are the part of navigation stack
.