Search code examples
iosswifteffectblurry

Swift iOS - How to make blurred effect that covers TabBarController and NavigationController


So I have learned to make a blurred effect according to post link. But that post does not issue how to make a blurred effect that also covers the TabBarController and NavigationController elements.

How can I make a blurred effect that covers the whole screen, including the TabBarController and NavigationController elements?


Solution

  • It's doing exactly what you ask right now, which is covering the entire view. That view, however, is of a child UIViewController, which has its real estate managed by a parent view controller. Only this parent has its view covering the entire screen. So in the case of embedding in a UINavigationController, you'd do instead:

    blurEffectView.frame = self.navigationController!.view.bounds
    self.navigationController!.view.addSubview(blurEffectView)