0

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?

Nick Kohrn
  • 5,779
  • 3
  • 29
  • 49
  • I was able to get ```presentingViewController.presentingViewController.dismissViewController:animated:completion``` working correctly, but I am still not sure why I cannot use an unwind segue with the presentation style as ```.OverCurrentContext``` as I feel that the code would be a little cleaner. I was not able to find anything in the documentation that specified unwind segues not being able to be used in conjunction with ```.OverCurrentContext```. Any ideas? – Nick Kohrn Jul 31 '15 at 15:10

1 Answers1

0

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.

Nick Kohrn
  • 5,779
  • 3
  • 29
  • 49
  • How can I pass a variable if I dismiss a View controller in the way mentioned above? – bably Sep 03 '15 at 11:53
  • 1
    @bably The only way that I can think of is to use a delegate pattern to pass information back to the view controller that you need to notify of an event. By using the delegation pattern, you can pass anything that you need to. – Nick Kohrn Sep 03 '15 at 13:11