How to get blur effect similar to Apple maps status bar?

I’m working on a map based iOS 11 application and want to make the status bar blurred exactly like it appears in the Apple maps.

This is how it looks on the Maps app:
AppleMaps

Currently, I’m using UIVisualEffectView to replicate this effect. Here’s my code:

let blurEffect = UIBlurEffect(style: .regular)
blurredStatusBar = UIVisualEffectView(effect: blurEffect)
blurredStatusBar?.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(blurredStatusBar!)

However, whatever UIBlurEffect I use, I’m not able to replicate the effect like Maps app. Here’s how it looks for different effects:

.regular
regular

.prominent
prominent

.light
light

.extraLight
extralight

I just want to the blur the status bar, without adding any saturation, vibrancy or any white color tint.

There is an instance property - backgroundFilters, which, possibly could have helped me but unfortunately it is not available for layers on iOS.

One possible solution suggested here was to capture the UIView content inside an image, then blurring and showing it. However, this is not a feasible solution in my case because I’ve got a map underneath the status bar which can be panned. It does not makes sense to continuously capture the underneath map as an image and blur it while the map is being panned.

I tried using ILTranslucentView, which is a little subclass of UIView that provide native iOS 7+ blur (translucent) effect. This is how it appeared:

iltranslucentview

I tried a couple of different approaches like this, but to no use.

Hi @fe_tech,
would it not do that automatically if you set the statusbar to be translucent?

cheers,

This topic was automatically closed after 166 days. New replies are no longer allowed.