AFB
AFB

Reputation: 560

iOS - Creating a blurred layer using CALayer

I created a CALayer with white color and 0.4 of opacity. What I want to is to make this layer above an image and make it blur, like the notification layer is blurring on the app or the home screen you're opening here's my CALayer:

CALayer *lyr = [CALayer layer];
lyr.bounds = CGRectMake(0, 0, 190, 190);
lyr.position = CGPointMake(90, 50);
lyr.backgroundcolor = [UIColor whiteColor].CGColor;
lyr.opacity = 0.4f;
[self.view.layer addSubLayer:lyr];

Sorry if I didn't explained what I need exactly
Thanks in Advance

Upvotes: 2

Views: 2261

Answers (1)

user2354690
user2354690

Reputation:

Take a look at FXBlurView https://github.com/nicklockwood/FXBlurView

It also provides a method to apply a tinted blur on an image.

- (UIImage *)blurredImageWithRadius:(CGFloat)radius iterations:(NSUInteger)iterations tintColor:(UIColor *)tintColor;

-> Import UIImage+FXBlurImage.h

Upvotes: 2

Related Questions