【发布时间】:2011-11-08 15:38:30
【问题描述】:
我需要像上面那样在 UILabel(或 CATextLayer)上实现外发光效果。我知道要在文本上创建发光效果,我需要偏移 (0,0) 的阴影。我已经接触到了quartz2D 级别,以下是我正在使用的代码:
_backgroundDownLabel.layer.shadowColor = self.glowColor.CGColor; // red
_backgroundDownLabel.layer.shadowOffset = CGSizeMake(0, 0);
_backgroundDownLabel.layer.shadowOpacity = 1;
_backgroundDownLabel.layer.shadowRadius = self.glowAmount; // tried 1-10
_backgroundDownLabel.layer.masksToBounds = NO;
问题:当我使用 RGB(1,0,0) 颜色作为阴影颜色来创建红光时,结果太微妙,意味着红光不够强。另一方面,客户设计师发给我一个PSD文件,其中发光颜色明亮而强烈。我猜这不是简单的发光,而是一些 Photoshop 滤镜,可能是外发光或某种组合。
那么,有没有办法通过代码来做类似的事情?
【问题讨论】:
标签: iphone ios ipad uilabel quartz-graphics