【发布时间】:2014-02-22 14:01:43
【问题描述】:
我正在开发一个项目,该项目使用来自此 GitHub 应用程序 TextGlowDemo 的代码。该应用程序基本上使用 QuartzCore 框架通过覆盖 drawTextInRect 并添加 CGContextSetShadow 和 CGContextSetShadowWithColor 来为 uilabel 添加投影,以使投影看起来像发光的文本。该程序在 ios 6 中完美运行,但在 ios7 中,辉光神秘地消失了。我没有收到有关已弃用方法的任何警告,所以我不知道发生了什么,有什么想法吗?
整个项目可以在这里找到: https://github.com/andrewgleave/TextGlowDemo
这是绘制发光的代码
- (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);
}
【问题讨论】:
标签: ios ios7 uilabel quartz-core glow