gpt4 book ai didi

swift - 如何使我的导航栏快速透明?

转载 作者:搜寻专家 更新时间:2023-10-31 08:13:12 26 4
gpt4 key购买 nike

我想像这样制作我的导航 Controller 。我的主要观点应该继续到顶部。 enter image description here

但是当我尝试实现它时,我得到了这个结果: enter image description here

我该如何处理这个问题。我想在第一张图片中实现类似的东西。有人可以帮忙吗?谢谢

最佳答案

我在我的应用程序中使用它来使我的导航栏透明(如果导航栏在 UINavigationController 中):

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

现在您仍然可以向导航栏添加按钮和标题。

编辑:Swift 3(感谢 DrBreakalot)

self.navigationController?.navigationBar.setBackgroundImage(‌​UIImage(), for: .default) 
self.navigationController?.navigationBar.shadowImage = UIImage()
self.navigationController?.navigationBar.isTranslucent = true

关于swift - 如何使我的导航栏快速透明?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35166197/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com