samedi 25 avril 2015

segue.identifier = nil in second view


I have IOS Swift program, using Storyboards with NavigationController. There are two Views, lets call them mainView, secondView.

From the mainView I have BarButtonItem to go to secondView. When pressing that button, it triggers prepareForSegue function in the mainView with segue.identifier = "secondView"

When I have opend e.g. the secondView, I have two BarButtonItems for Cancel and Save. When pressing either of them the prepareForSegue function in that view is triggered, but now the segue.identifier = nil.

I would have expected to have the segue.identifier = "cancel" or "save" depended on the button pressed in that view.

Am I misunderstanding the segue functionality? Can anyone try to enlight me about this, as this looks like a very important and useful part of storyboards and navigation - but somehow I am not getting it right.


Aucun commentaire:

Enregistrer un commentaire