如何在UIView的layerClass实例上使用CIFilter? [英] How to use a CIFilter on the layerClass instance of an UIView?

查看:64
本文介绍了如何在UIView的layerClass实例上使用CIFilter?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的UIView的图层使用TBPaperLayer的实例。

My UIView is using an instance of TBPaperLayer for its layer.

+(Class)layerClass {
    return [TBPaperLayer class];
}

我想创建一个CIFilter来修改该层的外观-特别是在其上应用模糊滤镜。
如何使用此代码模糊此层的一部分? (代码来自: Blur CALayer的超级层

I would like to create a CIFilter to modify the appearance of this layer - especially apply a blur filter on it. How can I use this code to blur a part of this layer ? (code from: Blur CALayer's Superlayer)

CALayer *blurLayer = [CALayer layer];
CIFilter *blur = [CIFilter filterWithName:@"CIGaussianBlur"];
[blur setDefaults];
blurLayer.backgroundFilters = [NSArray arrayWithObject:blur];
[self.superlayer addSublayer:blurLayer];

-init 期间没有超层。

推荐答案

在iOS上无法实现。来自 CALayer 类引用

This is not possible on iOS. From the CALayer class reference:


特殊注意事项 >

iOS的图层不支持此属性。

This property is not supported on layers in iOS.

想必苹果公司并不认为当前新一代的iOS硬件功能强大,足以支持实时图像过滤。

Presumably Apple don't feel that the current generation of iOS hardware is powerful enough to support live image filtering.

这篇关于如何在UIView的layerClass实例上使用CIFilter?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆