在 navigationItem.titleView 中将浮雕添加到 UILabel(如 navigationItem.title 所示) [英] Adding Emboss to a UILabel in a navigationItem.titleView (as seen with navigationItem.title)

查看:15
本文介绍了在 navigationItem.titleView 中将浮雕添加到 UILabel(如 navigationItem.title 所示)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试模仿自动应用于 navigationItem.title 以及许多其他 UIKit 控件的默认浮雕.

I'm trying to mimic the default emboss that automatically gets applied to navigationItem.title, as well as many other UIKit controls.

如该屏幕截图的标题所示(表格单元格"):

As seen in this screenshot's title ("Table Cells"):

浮雕标题 http://quicksnapper.com/files/3440/192219267049D92BB23DE74.png

我实际上是在尝试将 2 个 UILabel 添加到 navigationItem.titleView,但是 UILabel 只是显示为平面绘制,而且它真的感觉/看起来不正确:P

I'm essentially trying to add 2 UILabels to the navigationItem.titleView, however the UILabels just show up as flatly drawn and it really just doesn't feel/look right :P

我曾考虑过使用阴影,但这只会在标签的一侧产生浮雕外观(即使是这样).

I've thought about playing with shadows, but that would only give the embossed look (if even that) on one side of the label.

任何想法都会很棒!

谢谢

推荐答案

谢谢!我刚刚想通了:

postTitle 设置为白色,我只是添加了一个垂直偏移为 1px 的深灰色阴影.

where postTitle is set to a white colour, i just added a darkGray shadow with a vertical offset of 1px.

[postTitle setShadowColor:[UIColor darkGrayColor]];

[postTitle setShadowOffset:CGSizeMake(0, -1)];

看起来和你放在 .title 中的任何东西一模一样 :)

Looks exactly like anything you'd put in a .title :)

这篇关于在 navigationItem.titleView 中将浮雕添加到 UILabel(如 navigationItem.title 所示)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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