gpt4 book ai didi

ios - 同时设置导航 Controller 的标题(颜色/字体)(奇怪的行为)

转载 作者:行者123 更新时间:2023-11-28 11:20:25 25 4
gpt4 key购买 nike

当我尝试在应用程序委托(delegate)中自定义 UINavigation Controller 的外观时,我遇到了一些奇怪的行为。

UINavigationBar.appearance().titleTextAttributes = [NSFontAttributeName: UIFont(name: "Avenir Next", size: 20)!]

UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName: UIColor(red: 93/255, green: 173/255, blue: 173/255, alpha: 1)]

每当我先设置颜色时,字体都不会改变,而当我先设置字体时,颜色和字体都不会改变。但是,如果我自己设置喜欢,那么它就会改变……我似乎无法同时进行。有没有其他方法我应该这样做。

最佳答案

通过执行两次,您将撤消第一个。你需要这样做......

UINavigationBar.appearance().titleTextAttributes = [NSFontAttributeName: UIFont(name: "Avenir Next", size: 20)!, NSForegroundColorAttributeName: UIColor(red: 93/255, green: 173/255, blue: 173/255, alpha: 1)]

关于ios - 同时设置导航 Controller 的标题(颜色/字体)(奇怪的行为),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28664832/

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