Blur effect to view programmatically in IOS

Blur image effect iOS

Introduction to How to create blur effect to view programmatically in IOS:

Adding blur effect to view seems to be a daunting task. But its not, trust me. In this post we will learn, how can we add blur effect to our view in iOS SDK programmatically. Same as shown in above header image.

Download the files from given below link as they are required in order to achieve the blur effect.

ImageEffects

Jump to the code:

Now open your Xcode project and import two files required to create blur effect in the file where you need to add blur effect.

#import “UIImage+ImageEffects.h”
#import “UIImage+UIImage_ScreenShot_.h”
 
Below is the code that creates the nice blur effect
  UIImage *imageScreenShot = [UIImage screenshot];
    UIImage *blurred = [imageScreenShot applyLightEffect];
    UIImageView *blurrImageView = [[UIImageView alloc]initWithFrame:[UIScreen mainScreen].bounds];
    blurrImageView.image = blurred;
    [[UIApplication sharedApplication].delegate.window addSubview:blurrImageView];
 
In above code first we capture screenshot of our view. Then we applied the blur effect to the captured screenshot image. Finally we present the blurred image to our UIImageView and add it to our app window as subview.
Complete Code:  Click to download

Where to go from here:

in this post we learn how to create blurr effect in iOS sdk programmatically. Try it in your project, if face any problem them message me. Happy coding 🙂