Reputation: 15955
I am using some navigation controllers and my structure looks like this:
Top Nav ---Modal---> Middle Nav ---Model---> Bottom Nav
and
Top Nav ---Model---> Bottom Nav
In English, one navigation controler (Top Nav
) presents another navigation controller modally (Middle Nav
), which in turn presents another navigation controller modally (Bottom Nav
). The Button Nav
has a bar button that exits the view and performs an unwind action. The unwind action lives in Top Nav
. Bottom Nav
is reachable directly from both Middle Nav
and Top Nav
. The issue is that when I hit the bar button in Bottom Nav
it always unwinds to Top Nav
, even if I reached the view from Middle Nav
. How can I debug / fix this?
My initial thought is that the navigation view unwinds to the controller that handled the unwind. Does this mean I need to copy the unwind method in both controllers?
Upvotes: 1
Views: 157
Reputation: 539685
Yes, this is documented in Technical Note TN2298 – Using Unwind Segues:
How an Unwind Segue Determines its Destination View Controller
When an unwind segue is initiated, it must first locate the nearest view controller in the navigation hierarchy which implements the unwind action specified when the unwind segue was created. This view controller becomes the destination of the unwind segue. If no suitable view controller is found, the unwind segue is aborted.
Upvotes: 1