【问题标题】:iOS - Creating a blurred layer using CALayeriOS - 使用 CALayer 创建模糊层
【发布时间】:2014-01-04 12:52:52
【问题描述】:

我创建了一个白色和 0.4 不透明度的 CALayer。我想要的是在图像上方制作此图层并使其模糊,就像应用程序或您正在打开的主屏幕上的通知图层模糊一样,这是我的 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];

抱歉,如果我没有准确解释我需要什么
提前致谢

【问题讨论】:

标签: ios objective-c core-graphics core-animation


【解决方案1】:

看看FXBlurView https://github.com/nicklockwood/FXBlurView

它还提供了一种在图像上应用着色模糊的方法。

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

-> 导入UIImage+FXBlurImage.h

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-01-24
    • 1970-01-01
    • 1970-01-01
    • 2011-03-05
    • 2019-05-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多