3

I am trying to to use UIVisualEffectView on my modally presented view which gonna be sign in view for user.I really dont know what is going on with UIVisualEffectView.When the modal animation appear,it work fine.But,when the animation was done,the effect turn to dark grey,Any help with that?I am stucking with that for too long.

My Simulator,Also happen on iPhone

My Storyboard

Please Help?

Here is my source code , Download

Thiha Aung
  • 5,036
  • 8
  • 36
  • 79

3 Answers3

6

Underlying views will disappear once a modal covers them. To prevent this from happening, you need to set the UIModalPresentationStyle of the modal view controller to OverCurrentContext:

ModalVC.modalPresentationStyle = UIModalPresentationStyle.OverCurrentContext

David Fusilier
  • 301
  • 2
  • 8
1

The above answer is correct, but in my case my view controller is embedded in a navigation controller so it didn't work. This does:

vc.navigationController?.modalPresentationStyle = .overCurrentContext
Norman
  • 3,020
  • 22
  • 21
0

I think the problem is that you're not presenting your UIVisualEffectsView modally, but the view controller, so the gray you see is the background color of the right view controller. You could change that to the same gradient as the left one and see if that works, or you will need to display your UIVisualEffectsView on your first viewcontroller.

Luke35
  • 61
  • 1
  • 10