5
votes

I'm working on a storyboard-based iPhone app. I am successfully using unwind segues to navigate my stack of view controllers.

However, when I present a modal view controller I cannot seem to be able to trigger the unwind segue that I have specified in the storyboard file.

Is this normal or a bug?

2
Probably it's the normal behavior. Please elaborate with more details and a storyboard screenshot if possible.Desdenova
for modal views use dismissviewcontrolleranimatedCalin Chitu
I have no problem using 'dismissviewcontrolleranimated'. However, I'm trying to determine why the unwind functionality is not working in this case. I can find nothing pertinent in Apple's documentation.Konstantinos Kontos
I am using unwind segues in modal views without issues. What problem do you have exactly?user1459524

2 Answers

0
votes

Problem solved.

Apparently I've hit some glitch with the storyboard editor. What I did was to delete the destination (modal) view controller and then re-create it.

Works fine, now. Bug report filed.

0
votes

So I have the same problem (more than two years later!). I haven't fixed the underlying issue, but I found that a modal view being presented with a default presentation style will unwind OK, but one that uses a page sheet presentation style simply doesn't work. The unwindToViewX method gets called on the parent view controller that the unwind segue is moving to, though, so I've circumvented the issue with the following code:

if (self.presentedViewController) {
    [self dismissViewControllerAnimated:YES completion:NULL];
}

This saves me from setting up a delegate system as the unwind action is doing all the heavy lifting, but also avoids an issue where perhaps the unwind action might work one day, because in that case self.presentedViewController should return NO because the unwind action worked correctly and we won't end up dismissing two view controllers by accident.

I hope this helps others in the same boat, but I'd also like to hear if anyone else has better solutions.