Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS 7 style Blur view

Does anybody know of any controls that will replicate the iOS7 style blur views.

I'm assumming there can be some kind of UIView subclass that will replicate the behavior.

I'm talking about these type views which blur the background extremely thickly so that they have pull effects from the background view.

enter image description here

like image 966
endy Avatar asked Jun 11 '13 04:06

endy


People also ask

Does iPhone 7 have blur effect?

Adjust Depth Control in Portrait mode photos at the top of the screen. A slider appears below the photo. Drag the slider left or right to adjust the background blur effect. Tap Done to save your changes.

How do you get the blur effect on iPhone?

In the Camera app, simply tap the screen where you want the focus to be set. A yellow box will indicate the focus point. If the background doesn't look blurred, move a bit closer, then tap to set focus again. Remember, the closer you get, the blurrier the background will be!

Does Apple have a blur feature?

Open the Blur Photo Editor app to select a picture. Go to the blur effects and tap on the pixelated blur option. Choose the desired intensity, and get a blurred-out image. Tap on the top right corner button for photo sharing or saving.


2 Answers

You might be able to modify something like Bin Zhang's RWBlurPopover to do this. That component uses my GPUImage to apply a Gaussian blur to components underneath it, but you could just as easily use a CIGaussianBlur for the same. GPUImage might be a hair faster though.

That component relies on you being able to capture the view behind the one you're presenting, though, and may have trouble with views that animate behind this content. The need to take a trip through Core Graphics to rasterize the background view will slow things down, so we probably don't have sufficiently direct access to be able to do this in a performant manner for overlays on animating views.

As an update to the above, I recently reworked the blurs in GPUImage to support variable radii, allowing for the complete replication of the blur size in iOS 7's control center view. From that, I created the GPUImageiOS7BlurFilter class that encapsulates the proper blur size and color correction that Apple appears to be using here. This is how GPUImage's blur (on the right) compares to the built-in blur (on the left):

Apple's blurGPUImage's blur

I use a 4X downsampling / upsampling to reduce the number of pixels the Gaussian blur has to operate over, so an iPhone 4S can blur the entire screen in roughly 30 ms using this operation.

You still have the challenge of how to pull content into this blur from views behind this one in a performant manner.

like image 196
Brad Larson Avatar answered Sep 21 '22 04:09

Brad Larson


I am using FXBlurView which works great on iOS5+

https://github.com/nicklockwood/FXBlurView

CocoaPods:

-> FXBlurView (1.3.1)    UIView subclass that replicates the iOS 7 realtime background blur effect, but works on iOS 5 and above.    pod 'FXBlurView', '~> 1.3.1'    - Homepage: http://github.com/nicklockwood/FXBlurView    - Source:   https://github.com/nicklockwood/FXBlurView.git    - Versions: 1.3.1, 1.3, 1.2, 1.1, 1.0 [master repo] 

I added it by using:

FXBlurView *blurView = [[FXBlurView alloc] initWithFrame:CGRectMake(50, 50, 150, 150)]; [self.blurView setDynamic:YES]; [self.view addSubview:self.blurView]; 
like image 28
Paul Peelen Avatar answered Sep 23 '22 04:09

Paul Peelen