How to create a strong red glow on UILabel

enter image description here

I need to implement an external glow on a UILabel (or CATextLayer) as above. I know, to create a glow effect on the text, I need a shadow with an offset (0,0). I got to the quartz2D level, the following code I use:

    _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;

Problem: when I use the RGB color (1,0,0) as the shadow color to create a red glow, the result is too thin, which means that the red glow is not strong enough. On the other hand, the designer client sent me a PSD file in which a bright and strong glow color. I think this is not just a glow, but a Photoshop filter, perhaps an external glow or some combination.

So, is there a code way that I can do something like this?

+5
source share
2 answers

I'm not sure what exactly you are asking, but I think this will help: IPhone Text Glow Effect

In addition, if you want to create a red glow, such as .psd, why not just convert it to .png and use it in your application?

EDIT:

Brad Larson Advanced iPhone Development Courses iTunes U. ( Voodoo Pad, ) 2D- Quartz "". "QuartzExample".
, , .

+2

, ... - :

for (int i = 0; i < SOME_NUMBER; i++)
{
    CGContextSetShadowWithColor(UIGraphicsGetCurrentContext(),
                                CGSizeZero,
                                i * SOME_FACTOR,
                                [UIColor redColor].CGColor);
    [text drawAtPoint...
}

SOME_NUMBER SOME_FACTOR.

+1

All Articles