更改导航栏颜色

问题描述 投票:0回答:1

当选择“首选大标题”时,导航栏的“ TintColor”不变。我尝试从Attribute Inspector以及以编程方式更改它。我可以在情节提要中看到颜色的变化,但运行应用程序时看不到。我对titleColor也有同样的问题。

ios swift xcode uinavigationbar ios13
1个回答
0
投票

是,您需要在largeTitle模式下更改backgroundColornavigationBar。它与normalMode

完全不同。

带情节提要

Storyboard

带代码

navigationController?.navigationBar.backgroundColor = .brown

结果

LargeTitle

注意顶部白色区域实际上是backgroundColorRootViewController,您需要手动处理。

为每种颜色尝试不同的颜色,然后玩耍以进一步了解其行为

© www.soinside.com 2019 - 2024. All rights reserved.