swift - UINavigationController 导航栏不应用透明图像

标签 swift xcode

在导航标签栏中应用透明图像时。它变成白色而不是透明..

self.navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)
self.navigationController?.navigationBar.shadowImage = UIImage()
self.navigationController?.navigationBar.tintColor = UIColor.white

最佳答案

确保导航栏下方有一些东西,这样它就不会变得透明并显示白色背景。您需要将 uiview 拖到其下方,然后添加布局约束。否则,请确保您没有在其他地方更改导航栏的颜色。

关于swift - UINavigationController 导航栏不应用透明图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55583820/

相关文章:

ios - 在道路上随机放置图钉 - iOS Maps Swift

ios - 函数在 Swift 中不起作用

ios - setTexture 将我的 Sprite 的大小更改为更小,错误?

ios - SwiftUI:将 LazyVStack 或 LazyHStack 放入 ScrollView 会导致卡顿(Apple 错误??)

ios - Realm - 订购元素?

json - "login"和 "sign up"Web 服务未使用 alamofire 快速提供所需的 json 输出

swift - NSScrollViews documentView 的约束不能正常工作

ios - 将数据从 Objective-C Viewcontroller 传递到 Swift ViewController

ios - 我的 XCode UI 测试如何检测到屏幕已更改?

xcode - iOS 4.1 SDK - 设备构建的多个静态库链接中的重复符号