本文介绍了在Mavericks下的CALayer中添加CIFilter?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
所以这是添加过滤器到图层的标准方式:
so this is the standard way of adding filter to a layer:
NSView *view = self.window.contentView;
view.wantsLayer = YES;
CATextLayer *textLayer = [CATextLayer layer];
textLayer.frame = CGRectMake(10.0, 10.0, 200.0, 100.0);
textLayer.string = @"foo";
textLayer.foregroundColor = [[NSColor redColor] CGColor];
// Add filter
CIFilter *filter = [CIFilter filterWithName:@"CIGaussianBlur" keysAndValues:@"inputRadius", @5.0, nil];
textLayer.filters = @[filter];
// Attach layer
[view.layer addSublayer:textLayer];
但是,它在OS X Mavericks上崩溃了我的应用程序。用于10.8的工作。
However, it crashes my application on OS X Mavericks. Used to work on 10.8.
2013-10-23 13:09:20.767 Serus[3608:303] *** Terminating app due to uncaught exception 'CAInvalidCIFilter', reason: 'CI filters are not supported by this layer tree: {CIGaussianBlur {
inputImage = "<null>";
inputRadius = 10;
}}.'
此图层树不支持CI过滤器
有人见过这个吗?
推荐答案
想想,苹果决定改变这一点,并要求一个新的标志没有理由
Figured it out, Apple decided to change this and require a new flag for no reason
progressIndicator.layerUsesCoreImageFilters = YES;
这篇关于在Mavericks下的CALayer中添加CIFilter?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!