2012-04-05 54 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 

希望這有助於!