0

I am working on a project that utilizes code from this GitHub app, TextGlowDemo. The app basically uses the QuartzCore Framework to add a drop-shadow to a uilabel by overriding drawTextInRect and adding CGContextSetShadow and CGContextSetShadowWithColor to make the drop shadow look like glowing text. The program works perfectly in ios 6, but in ios7 the glow mysteriously disappears. I do not get any warnings about deprecated methods so I do not know what is going on, any ideas?

Entire project can be found here: https://github.com/andrewgleave/TextGlowDemo

here is the code that draws the glow

- (void)drawTextInRect:(CGRect)rect 
{
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextSaveGState(context);

    CGContextSetShadow(context, self.glowOffset, self.glowAmount);
    CGContextSetShadowWithColor(context, self.glowOffset, self.glowAmount, glowColorRef);

    [super drawTextInRect:rect];

    CGContextRestoreGState(context);
}
Akshit Zaveri
  • 4,166
  • 6
  • 30
  • 59
Beleg
  • 362
  • 2
  • 23

2 Answers2

1

Looks like the latest IOS upgrade fixed this problem. It started working before I had the opportunity to try Brett's solution.

Beleg
  • 362
  • 2
  • 23
0

I believe that your self.glowOffset is probably CGSizeZero. I am not sure why, but in iOS7 you don't see a shadow with an offset with CGMakeSize(0.0f, 0.0f).

Brett
  • 1,647
  • 16
  • 34