Skip to content

Instantly share code, notes, and snippets.

@adamdehaven
Last active August 29, 2015 14:01
Show Gist options
  • Save adamdehaven/1eb796dd609ac65c3fc7 to your computer and use it in GitHub Desktop.
Save adamdehaven/1eb796dd609ac65c3fc7 to your computer and use it in GitHub Desktop.
Blur current view
#import "UIImage+ImageEffects.h"
// Blur view while sidebar is open
UIGraphicsBeginImageContext(self.tableView.contentSize);
CGContextRef c = UIGraphicsGetCurrentContext();
CGContextTranslateCTM(c, 0, 0);
[self.view.layer renderInContext:c];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
viewImage = [viewImage applyBlurWithRadius:3.5 tintColor:nil saturationDeltaFactor:1.4 maskImage:nil];
UIGraphicsEndImageContext();
UIImageView *blurView = [[UIImageView alloc] initWithImage:viewImage];
[self.view addSubview:blurView];
[self.view bringSubviewToFront:blurView];
#import "UIImage+ImageEffects.h"
// Blur view while sidebar is open
UIGraphicsBeginImageContext(self.tableView.contentSize);
CGContextRef c = UIGraphicsGetCurrentContext();
CGContextTranslateCTM(c, 0, 0);
[self.view.layer renderInContext:c];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
viewImage = [viewImage applyBlurWithRadius:3.5 tintColor:nil saturationDeltaFactor:1.4 maskImage:nil];
UIGraphicsEndImageContext();
UIImageView *blurView = [[UIImageView alloc] initWithImage:viewImage];
[self.view addSubview:blurView];
[self.view bringSubviewToFront:blurView];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment