gpt4 book ai didi

ios - 在屏幕上查看后 setTitleTextAttributes 不起作用。 iOS 11

转载 作者:可可西里 更新时间:2023-11-01 06:00:45 24 4
gpt4 key购买 nike

我花了一整天的时间尝试更改 UIBarButtonItem 的颜色,现在我认为这是一个 iOS 11 错误,除非有人能告诉我这是设计使然。

我可以使用这段代码改变文本的颜色

[self.refreshButton setTitleTextAttributes:@{NSForegroundColorAttributeName: [UIColor orangeColor]} forState:UIControlStateNormal];

如果我将代码添加到 viewWillAppear:animated 函数中,它可以正常工作,但是如果将它添加到 viewDidAppear:animated 中,它就不起作用。

它似乎适用于 iOS 9 模拟器,但不适用于 iOS 11。

iOS 11 在这方面有什么变化吗?

最佳答案

如果您只想更改UIBarButtonItem 的标题颜色,您可以设置tintColor 属性而不是setTitleTextAttributes:。如果您希望所有 UIBarButtonItems 具有相同的标题颜色,您可以设置工具/导航栏的 tintColor

关于ios - 在屏幕上查看后 setTitleTextAttributes 不起作用。 iOS 11,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47060360/

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