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 测试版中的错误吗?我已经记录了一个雷达,但只是想看看是否有其他人遇到过这个问题或找到了解决方法。
正如您在下面看到的,后退箭头和加号按钮的颜色不正确。
最佳答案
你必须设置:
let backImage = appearance.backIndicatorImage.tint(with: tintColor)
appearance.setBackIndicatorImage(backImage, transitionMaskImage: backImage)
关于ios - UINavigationBarAppearance 不适用于基于图像的栏按钮项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57634813/