将浮动添加到navigationItem.titleView中的UILabel(如使用navigationItem.title所见) [英] Adding Emboss to a UILabel in a navigationItem.titleView (as seen with 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"):
我基本上试图添加2 UILabels到navigationItem.titleView,但UILabels只是显示为平面绘制,它真的只是感觉不到/看起来不错: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的darkGray阴影。
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屋!