gpt4 book ai didi

ios - UINavigationBarAppearance 不适用于基于图像的栏按钮项目

转载 作者:搜寻专家 更新时间:2023-11-01 05:31:49 26 4
gpt4 key购买 nike

Xcode 版本 11.0 beta 5 (11M382q)

当我的 View Controller 之一是顶部 View Controller 时,我正在使用新的外观 API 为条形按钮项目着色。我正在使用以下代码来执行此操作:

let appearance = UINavigationBarAppearance()
let attributes: [NSAttributedString.Key : Any] = [.foregroundColor : tintColor]

appearance.largeTitleTextAttributes = attributes
appearance.buttonAppearance.normal.titleTextAttributes = attributes
appearance.doneButtonAppearance.normal.titleTextAttributes = attributes

navigationItem.standardAppearance = appearance

这似乎适用于基于文本的栏按钮项目,但基于图像的栏按钮项目保持应用程序的默认色调。这是 iOS 13 测试版中的错误吗?我已经记录了一个雷达,但只是想看看是否有其他人遇到过这个问题或找到了解决方法。

正如您在下面看到的,后退箭头和加号按钮的颜色不正确。

Screenshot displaying incorrect bar button item tint

最佳答案

你必须设置:

let backImage = appearance.backIndicatorImage.tint(with: tintColor)
appearance.setBackIndicatorImage(backImage, transitionMaskImage: backImage)

关于ios - UINavigationBarAppearance 不适用于基于图像的栏按钮项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57634813/

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