0

I have been trying to solve this for a while with a variety of people suggesting several different ways to achieve this and none of them working for me.

I am trying to display a view controller over the current context with a clear background. However each time I perform the segue the view controller underneath is removed from the view hierarchy.

Here is the presenting view controller. Presenting View Controller

And here is the current state when presenting the view modally. Modal popup

As the segue is taking place the modal has the correct transparency effect however when the segue completes the background turns black indicating the view controller has been removed from the hierarchy.

Now many suggestions focus on setting up the modal in code however all these settings are available in the storyboard and I prefer to leave things like that in there. As suggested here I have setup my view controllers like this however I still have the above effect.

Here is my storyboard setup.

Presenting view controller settings Presenting view controller settings

Segue settings Segue settings

Modal view controller settings Modal view controller settings

Any help would be much appreciated.

Community
  • 1
  • 1
Gerard Wilkinson
  • 1,512
  • 14
  • 33

1 Answers1

1

you can make those view controllers child of the VC you want to present them on here, by making one view controller child of another, you can add view of child VC as a subview to the view of parent VC

you can then play with transparency/color of child VC view's

This can also be helpful tutorial

presenting view controller on top of the current one won't work for you, you will have add other view controller as child for the current one and then add it's view as subview to the current VC's view. then if you clear background color for child VC's view it will appear transparent and show you previous VC's view in background

Edit: you can achieve the same effect using presentation controller here

Usama
  • 1,945
  • 1
  • 13
  • 20
  • Hi Usama, I was going to look at doing this with a container view and I know that it is possible with this. However what I am asking is possible using modal views. Others like the one I link to in the question have shown this technique to be working. However in my case it isn't for some reason. – Gerard Wilkinson Aug 20 '15 at 12:30
  • i have vague idea that it can be done using presentation controllers which are introduced in iOS8>, have a look at them it might be helpful. i will post a link if find a way using presentation controllers – Usama Aug 20 '15 at 12:36
  • i have updated my answer, a tutorial is provided which shows how you can achieve the same effect using presentation controller. hope it helps – Usama Aug 20 '15 at 12:41
  • Thanks Usama. I had already seen this as an option however the storyboard methods should also work according to Apple's documentation. Writing custom transitioning delegates seems a little over the top for this simple effect but I have done this now and it works well. Thanks for your help. – Gerard Wilkinson Sep 15 '15 at 14:00
  • First link in answer is dead (*Sorry, that page cannot be found.*). – Pang Jun 04 '16 at 07:44