Last active
August 29, 2015 14:01
-
-
Save adamdehaven/1eb796dd609ac65c3fc7 to your computer and use it in GitHub Desktop.
Blur current view
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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