【问题标题】:I can not figure out why TextGlowDemo no longer functions in ios7我无法弄清楚为什么 TextGlowDemo 在 ios7 中不再起作用
【发布时间】:2014-02-22 14:01:43
【问题描述】:

我正在开发一个项目,该项目使用来自此 GitHub 应用程序 TextGlowDemo 的代码。该应用程序基本上使用 QuartzCore 框架通过覆盖 drawTextInRect 并添加 CGContextSetShadowCGContextSetShadowWithColor 来为 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


    【解决方案1】:

    看起来最新的 IOS 升级解决了这个问题。在我有机会尝试 Brett 的解决方案之前,它就开始工作了。

    【讨论】:

      【解决方案2】:

      我相信你的 self.glowOffset 可能是 CGSizeZero。我不知道为什么,但在 iOS7 中,您看不到带有 CGMakeSize(0.0f, 0.0f) 偏移的阴影。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2021-05-29
        • 1970-01-01
        • 2014-12-08
        • 2012-05-16
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多