0
votes

When I start a new single view iOS app project in XCode, I can have blur effect on the background while using a "pop-up style" VC by using Interface Builder without any problem. Let me first explain the steps how I exactly do it:

  1. Open XCode, create a new Single View iOS Application project
  2. Create a View Controller, then a second View Controller.
  3. Add "Visual Effect View with Blur" object to the second VC by replacing existing "View" object (by drag-drop on top of it in the Document Outline).
  4. Create a segue from 1st VC to 2nd VC and choose "Present Modally" option
  5. Select "Over Current Context" in the "Presentation" option in the second VC
  6. Finally, when I build and run and trigger the segue with a button, the 2nd VC comes from bottom and 1st VC is shown in the background as blurred.

Everything works as expected.

However, I cannot get the same result in my existing iOS app project with the exact same steps. In this existing project I used Table Views, Table View Controllers, Container Views and other UI elements. However, to test it, I created a separate, independent VC in this existing project, created a new initial navigation controller, and took the exact same steps I explained above, by creating new 1st and 2nd VCs. Even if there is no connection with the existing code and design, I still cannot get the blurred and visible background of first VC in my tests. After the segue occurs, background is white and 1st VC is not visible at all. No place is blurred.

There may be one clue: In my existing project, when I select "Over current context" option in the segue or in the options of the second VC, the background color of 2nd VC becomes white in Interface Builder. But in my test project, this color stays as gray upon this selection. Problem is probably related to this.

If I select "Over current context" in 2nd VC before I create the segue, background stays gray in 2nd VC in Interface Builder. However at the moment I created the segue as "Present modally", the background becomes white in the 2nd VC in Interface Builder.

I have no idea why the steps I explained above doesn't work in this existing project but it works in a brand new one.

I tried to clean build folder, tried to restart my XCode (v10.3), tried to restart my Mac (v10.14.5), but I can't think of anything else. I spent many hours already, I cannot understand why this does not work in this existing project. What can be the reason, any idea will be appreciated.

1

1 Answers

0
votes

Set Transition Style to Cross Dissolve and Presentation Context Over Current Context on your second view controller. Put self.view.backgroundColor = .clear in view didload of your second view controller