Cannot Get Unwind Segue Working with Modal View Controller Presented Over Current Context

江枫思渺然 提交于 2019-12-25 12:27: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:


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.



来源:https://stackoverflow.com/questions/31748605/cannot-get-unwind-segue-working-with-modal-view-controller-presented-over-curren

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!