如何在UILabel上创建强烈的红色发光效果 [英] how to create a strong red glow effect on UILabel

查看:116
本文介绍了如何在UILabel上创建强烈的红色发光效果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要如上所述在UILabel(或CATextLayer)上实现外部发光效果。我知道要在文本上创建发光效果,我需要带偏移(0,0)的阴影。我已经接触到quartz2D级别,以下是我正在使用的代码:

I need to implement outer glow effect on UILabel (or CATextLayer) as above. I know to create glow effect on text, I need shadow with offset (0,0). I've touched down to the quartz2D level, following is the code I'm using:

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

问题:当我使用RGB(1,0,0)颜色作为阴影颜色来创建一个红光,结果太微妙,意味着红光不够强烈。另一方面,客户设计师给我发了一个PSD文件,其中发光颜色明亮而强烈。我想这不是一个简单的发光,而是一些Photoshop滤镜,可能是外部发光或某种组合。

Problem: when I use RGB(1,0,0) color as the shadow color to create a red glow, the outcome is too subtle, meaning the red glow is not strong enough. On the other hand, client designer sent me a PSD file, in which the glow color is bright and strong. I guess it's not a simple glow but some Photoshop filter, maybe outer glow or some combination.

那么,代码是否有办法可以做类似的事情?

So, is there a way by code that I can do something similar?

推荐答案

我不确定你在问什么,但我认为这会有所帮助: IPhone Text Glow Effect

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

此外,如果你想创建像上面的.psd一样的红色光芒,为什么不将它转换为.png并在你的应用中使用它?

Also, if you want to create a red glow like the .psd above, why not just convert it to .png and use it in your app?

编辑:

我刚从 Brad Larson的高级iPhone开发课程。你将必须在 Brad Larson的个人资料下载课程笔记(你必须让Voodoo Pad打开它们)然后去进入计划下的Quartz 2D Drawing笔记。然后你必须下载名为QuartzExample的示例代码。

希望如果你还没有找到解决方案,这可以帮助你。

I just found a solution to your problem from Brad Larson's Advanced iPhone Development Courses on iTunes U. You will have to download the course notes over at Brad Larson's profile (You have to have Voodoo Pad to open them) and go into the Quartz 2D Drawing notes under "schedule." Then you'll have to download the sample code called "QuartzExample".
Hope this helps you out if you haven't found a solution already.

这篇关于如何在UILabel上创建强烈的红色发光效果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆