如何在 UILabel 上制作倒影?

发布于 2024-10-07 12:57:07 字数 550 浏览 0 评论 0原文

我试图在我的应用程序中的 UILabel 上获得“嵌入”效果。

这就是我的意思:

alt text

我希望它看起来像字体“嵌入”或压入背景。请注意,此字体是动态的,UILabel 将以编程方式更改。

关于如何做到这一点,或者关于什么字体看起来像这样,有什么想法吗?

提前致谢!

--------------------------------------------------------- -------------------------------------------------- -------------

编辑:感谢fbrunel,我知道了如何做到这一点。不过还是看看结果吧。

alt text

它看起来确实不太好,有什么想法吗?

I'm trying to get an "embed" effect on my UILabel in my app.

Here's what I mean:

alt text

I want it to look like the font is "embedded" or pressed into the background. Please note this font is dynamic, the UILabel will be changed programmatically.

Any ideas as to how this can be done, or as to what font looks like this?

Thanks in advance!

--------------------------------------------------------------------------------------------------------------

Edit: Thanks to fbrunel, I figured out how to do it. Check out the result, though.

alt text

It really doesn't look very nice, any ideas why?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

倾听心声的旋律 2024-10-14 12:57:07

这是通过在文本上使用“倒置”阴影来完成的。在 UILabel 上,您有两个属性可以执行此操作:shadowColor 和shadowOffset(阴影的方向)。

label.shadowColor = [UIColor whiteColor];
label.shadowOffset = CGSizeMake(0, 1);

会成功的。

It's done using an "inverted" shadow on the text. On UILabel you have two properties to do this: shadowColor and shadowOffset (the direction of the shadow).

label.shadowColor = [UIColor whiteColor];
label.shadowOffset = CGSizeMake(0, 1);

Will do the trick.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文