How to use a CIFilter on the layerClass instance of an UIView?

core-animation, core-image, ios

Solution

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

Special Considerations

This property is not supported on layers in iOS.

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

Problem

My UIView is using an instance of TBPaperLayer for its layer. ``` +(Class)layerClass { return [TBPaperLayer class]; } ``` 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]; ``` There is no superlayer during `-init`.

Original source