Add this to the beginning of the AppDelegates.h
#import <QuartzCore/QuartzCore.h>
@interface CAFilter : NSObject
@end
Add this to the didFinishLaunchingWithOptions method (before makeKeyAndVisible call)
CAFilter* filter = [CAFilter filterWithName:@"gaussianBlur"];
[filter setValue:[NSNumber numberWithFloat:5] forKey:@"inputRadius"];
window.layer.filters = [NSArray arrayWithObject:filter];
Other way you can use this in UIView:
- (IBAction)toggleBlur {
CALayer *layer = [self.blurView layer];
blur = !blur;
if (blur) {
[layer setRasterizationScale:0.3];
[layer setShouldRasterize:YES];
} else {
[layer setRasterizationScale:1.0];
[layer setShouldRasterize:NO];
}
}
See the other static filters available at: