简体   繁体   English

如何在 iOS9 中获取透明的 UIToolbar 或 UINavigationBar

[英]How to get transparent UIToolbar or UINavigationBar in iOS9

I would like an entirely transparent UIToolbar and/or UINavigationBar.我想要一个完全透明的 UIToolbar 和/或 UINavigationBar。 I have tried the many suggestion but didn't works.我已经尝试了许多建议,但没有奏效。 This is my Code for navBar这是我的导航栏代码

  navigationController?.navigationBar.setBackgroundImage(UIImage(), forBarMetrics:.Default)
    navigationController?.navigationBar.shadowImage = UIImage()
    navigationController?.navigationBar.translucent = true

This is a good example "the App Store"这是“App Store”的一个很好的例子

在此处输入图片说明

Just make sure you don't have something behind your tool bar.只要确保你的工具栏后面没有东西。 Like a collection view and so on.像集合视图等等。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM