Cannot Get Unwind Segue Working with Modal View Co

2019-09-11 15:05发布

This is regarding the latest version Xcode 6 and iOS 8.4.

I have a set of three view controllers, which VC2 & VC3 are presented modally:

VC1 -> VC2 -> VC3

Each of the segues are presented with a presentation style of .OverCurrentContext. I am using this presentation style because both VC2 & VC3 have a UIVisualEffectView with a blurred background to let the view underneath subtly show through.

My issue is that the unwind segue that I have created does not unwind neither VC2 or VC3 to VC1 with the presentation style of .OverCurrentContext. However, when I change the presentation style back to .Defatult it works.

I would really prefer to use .OverCurrentContext because having to use dismissViewController:animated:completion causes a second unwanted animation of both view controllers when dismissing. I want to be able to dismiss VC3 and immediately see VC1 without seeing VC2 animate it's dismissal between. Also, I do not like using presentingViewController.presentingViewController.dismissViewController:animated:completion because it also causes the unwanted animation of dismissing VC2 after VC3 has been dismissed.

Any suggestions on how to solve this?

1条回答
贪生不怕死
2楼-- · 2019-09-11 15:44

I was able to use presentingViewController.presentingViewController.dismissViewController:animated:completion from VC3 to achieve the same effect as using an unwind segue.

However, as noted in my comment, I would still like to know why I had to resort to this rather than being able to use an unwind segue with .OverCurrentContext.

查看更多
登录 后发表回答