Sunday, February 21, 2016

Blurring an image in iOS

Image 1 like this can be blurred to the one seen on the right image 2
]

Below is the code to do this.
self.imageView.image = [UIImage imageNamed:@"register_page.jpeg"];
    
    // create effect
    UIBlurEffect *blur = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
    
    // add effect to an effect view
    UIVisualEffectView *effectView = [[UIVisualEffectView alloc]initWithEffect:blur];
    effectView.frame = self.view.frame;
    
    // add the effect view to the image view
    [self.imageView addSubview:effectView];
  

References:
http://stackoverflow.com/questions/17036655/ios-7-style-blur-view

No comments:

Post a Comment