wuleijun / LBBlurredImage

LBBlurredImage is an UIImageView category that permit to set an image and make this blurred

Home Page:http://lucabernardi.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

LBBlurredImage

LBBlurredImage is an UIImageView category that permit to set an image and make this blurred.

Here are an example of what you can achieve:

Installation

Copy file

This code must be used with deploy target 6.0+ and under ARC. If your code doesn't use ARC you can mark this source with the compiler flag -fobjc-arc

  • Just grab the two file named UIImageView+LBBlurredImage.{h,m} and UIImageImage+ImageEffects.{h,m} in the Additions group into your project and link with Accelerate.framework .
  • #import "UIImageView+LBBlurredImage.h" where you need it.

CocoaPods

You can use CocoaPods to manage your dependencies and install LBBlurredImage. Follow the instructions on the CocoaPods site to install the gem and add pod 'LBBlurredImage' to your Podfile.

Use

[self.imageView setImageToBlur:[UIImage imageNamed:@"example"]
                    blurRadius:kLBBlurredImageDefaultBlurRadius
               completionBlock:^(){
                   NSLog(@"The blurred image has been set");
               }];

The generation of the blurred image is made on a background thread, for this reason a completion block is provided. The completionBlock is dispatched on the main thread when the image has been generated and set to the UIImageView.

The code is provided with an example project if you want to see the class in actions.

License

LBBlurredImage is available under the MIT license. See the LICENSE file for more info.

About

LBBlurredImage is an UIImageView category that permit to set an image and make this blurred

http://lucabernardi.com

License:MIT License