如何让UIToolbar有一个清晰的背景? [英] How to make UIToolbar have a Clear Background?

查看:129
本文介绍了如何让UIToolbar有一个清晰的背景?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个UIToolbar,它有一个白色调,带有一个条形按钮项,后面是一些灵活空间,后面是另一个条形按钮项。我想让工具栏完全清晰,以便我可以看到灵活空间下的内容(我不关心看到按钮后面的内容)。有没有办法做到这一点?
我尝试将工具栏设置为半透明,但这并不能完全清楚。

I have a UIToolbar that has a white tint, with a bar button item, followed by some flexible space, followed by another bar button item. I would like to make the toolbar completely clear so that I can see what is under the flexible space (I don't care about seeing what is behind the buttons). Is there a way to do this? I have tried setting the toolbar to translucent, but that does not make it completely clear.

推荐答案

[self.toolbar setBackgroundImage:[UIImage new]
              forToolbarPosition:UIToolbarPositionAny
                      barMetrics:UIBarMetricsDefault];

 [self.toolbar setBackgroundColor:[UIColor clearColor]];

这篇关于如何让UIToolbar有一个清晰的背景?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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