Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Aspect fill blurry view

Tags:

swift

I created some pageController which is working but with one problem. I have background image and I've added blurry view to it. But it doesn't stretch with the image:

enter image description here

The way I created the blurry view is this:

let blurEffect = UIBlurEffect(style: .dark)
        let blurEffectView = UIVisualEffectView(effect: blurEffect)
        blurEffectView.frame = self.view.frame

        self.view.insertSubview(blurEffectView, at: 1)

I have tried to make image to aspect fill, aspect fit etc.. Nothing works.

like image 703
Tarvo Mäesepp Avatar asked Nov 17 '25 11:11

Tarvo Mäesepp


1 Answers

You have to constrain the blur effect view to the image view, just as you would with any kind of view.

like image 169
NRitH Avatar answered Nov 19 '25 09:11

NRitH