为字体制作发光效果

时间:2012-04-05 23:15:02

标签: ios

我想知道是否有人为字体的Glow效果有一个例子?我试图查看NSAttributedString,但我找不到发光文本的属性。

1 个答案:

答案 0 :(得分:2)

试试这个:

#include <Quartzcore/Quartzcore.h>
.......
yourLabel.layer.shadowColor = [[UIColor glowColor] CGColor]; //Replace glowColor with the desired color (redColor, greenColor, etc.)
yourLabel.layer.shadowOffset = CGSizeMake(0.0, 0.0); //The glow starts from the center

yourLabel.layer.shadowRadius = 20.0; //You can change this to the desired amount
yourLabel.layer.shadowOpacity = 0.5; //You can change this to the desired amount

yourLabel.layer.masksToBounds = NO; //Keep this the same to avoid shadow being clipped by the label bounds

希望这有帮助!