2012-04-05 53 views
0

我想知道是否有人有字体发光效果的例子吗?我试图查看NSAttributedString,但我没有在属性中找到发光文本。制作发光效果字体

+1

可能的重复[是否有简单的方法或库可用来让文本发光?](http://stackoverflow.com/questions/1229721/is-there-an-easy-way-or-library-available-到让文本辉光) – jrturton 2012-06-02 14:15:24

回答

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 

希望这有助于!