iosuiviewcontrolleruinavigationcontrollerstoryboardsegue

ViewController showing extra left item out of nowhere if I do a segue from another VC


I currently have a setup of 2 view controllers with the 1st one embedded in a navigation controller. I set up a segue from the 1st to the 2nd which works. However, after trying to set up another segue from the 2nd one's 'Save' button back to the 1st, the 1st view controller is displaying the name of the 2nd one w/ an extra left navigation bar item showing. If I were to hold the cursor on that item, it seems to show the names of the 2 VCs in repeated occurrences. Does anybody know why this is the case? Thanks.

Buggy item marked in red: enter image description here

I tried changing the different ways of segue performance, but all of them seem to be showing the same, buggy left 'go back' item with the name of the 2nd VC.

The correct result should be that after pressing the 'Save' button, it goes back to the 1st VC with the correct navigation items on top. Only the title and the plus symbol.


Solution

  • Your segue from the save button is pushing a new instance of the first view controller into the navigation hierarchy. It is not moving back to the view controller you came from. That is why you see the "back" navigation item on the left.

    You can use an unwind segue to go back to the existing instance of the first view controller.