Secret Lab

View Original

UIView+BlurFade

We made another nifty little extension!

UIView+BlurFade is an Objective-C category lets you take any UIView and make it blurry and greyscale. This is super useful for when you want to make a view look disabled, and looks really pretty to boot!

This category uses Core Image to perform the blurring and grey-scaling. Because you can't apply CIFilters to views on iOS, it actually cheats a little bit - instead of gradually blurring the view over time, it blurs it once, stores it in an image, and then fades that image over your original content.

To use this category, just drop the two files into your project and #import them. Then, when you want to make your view go blurry and faded out, you just do this:

See this content in the original post

To remove the blur effect, you call its counterpart:

See this content in the original post

We hope you find UIView+BlurFade useful! If you have any comments, either create an issue on GitHub, or shoot us an email!