Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Standard iOS 7 blur implementation

Tags:

I have read dozens of questions about mimicking iOS 7 blur effect in earlier versions of iOS. But the fundamental question that arises here is does iOS 7's UIKit really have a nice and convenient way to make any UIView blurred? That seems quite logical to me. Any help appreciated.

like image 250
Sergey Grischyov Avatar asked Sep 20 '13 23:09

Sergey Grischyov


People also ask

What type of blur does iOS use?

There are two options: UIBlurEffect and UIVibrancyEffect . UIBlurEffect adds a blur over the content underneath the visual effect view and has been around since iOS 8.


1 Answers

Apple has provided sample code to blur any UIImage in iOS 7's style.

Go to Apple Developer downloads and log in if necessary. Search for "imageeffects" to bring up the WWDC 2013 Sample Code entry, and download the iOS_UIImageEffects sample code.

In that project, there's a UIImage category in UIImage+ImageEffects.h that you can copy into your own project, containing the applyBlurWithRadius:... method.

You'll need to link your project with the Accelerate framework.

This won't automatically do a blur on a view in realtime — for that, see FXBlurView, which performs a similar technique by automatically snapshotting its superview. It can be pretty performance-intensive, though: consider first whether you can achieve what you want by statically blurring an image, rather than trying to "live"-blur moving content.

like image 126
Marco Avatar answered Sep 26 '22 07:09

Marco