gpt4 book ai didi

ios - 半透明,带有快速导航栏

转载 作者:行者123 更新时间:2023-11-30 12:00:21 31 4
gpt4 key购买 nike

我将导航栏自定义为清除。所以我将backgroundImage设置为UIImage()并且isTranslucent = true。所以我遇到的问题是:这就是我在 xib 中设置的。现在 TopConstraints 是: 10px enter image description here当 topConstraint = 10 时。当我在模拟器 iPhone 5s 中运行时:这就是我得到的。屏幕很完美。虽然我记得,如果我设置 isTranslucent = true -> 我必须设置 topConstraint 高于导航栏高度,例如:topConstraint = 50。 enter image description here 。但是使用这段代码,当我尝试在真实设备:iPhone 5s 中运行时。这就是我得到的:enter image description here导航栏覆盖了 View 。我的模拟器运行在iOS 11.0,真实设备运行在iOS 9.2。有人有同样的情况吗?非常感谢

顺便说一句:我需要将导航栏设置为清晰,因为我们的背景颜色是从左上角到右下角的渐变颜色

最佳答案

将背景图像删除为 UIImage() 并尝试以下操作:

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)

self.navigationController?.navigationBar.isTranslucent = true
self.navigationController?.navigationBar.backgroundColor = UIColor.clear
}

并保持 topConstraint = 10

关于ios - 半透明,带有快速导航栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47314310/

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