gpt4 book ai didi

iOS:导航顶栏和 UIviewController 的其他内容之间的线

转载 作者:行者123 更新时间:2023-12-01 18:39:27 25 4
gpt4 key购买 nike

我使用 Swift 3 和 Xcode 8.1 创建了一个应用程序,我有一个带有导航栏的 View Controller ,我的 View 在导航栏和其他 viewController 的内容之间显示了一条线(分隔符)。

我在 viewDidLoad 中使用以下代码:

 self.navigationController?.navigationBar.isTranslucent = false 

但没有任何改变,更多细节请看截图: This image of what I have

我能做些什么来解决这个问题?

最佳答案

尝试:

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

如果您想将此效果应用于整个应用程序(这样您就不需要为每个导航 Controller 编写此代码),您可以使用:
UINavigationBar.appearance().setBackgroundImage(UIImage(), forBarPosition: UIBarPosition.Any, barMetrics: UIBarMetrics.Default)
UINavigationBar.appearance().shadowImage = UIImage()

关于iOS:导航顶栏和 UIviewController 的其他内容之间的线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45652406/

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