gpt4 book ai didi

ios - 操作表文本始终为灰色(NSAttributedString.Key 不起作用)

转载 作者:行者123 更新时间:2023-11-29 05:11:07 27 4
gpt4 key购买 nike

我正在使用带有一些文本显示的自定义操作表。对于 XCode 11.3,我无法使用 NSAttributedString.Key.foreground。更新之前可以用,但现在找不到解决办法。

Screengrab with example of my problem

enter image description here

    let attributedMessageText = NSMutableAttributedString(
string: description,
attributes: [
NSAttributedString.Key.paragraphStyle: paragraphStyle,
NSAttributedString.Key.font: UIFont.systemFont(ofSize: 13.0),
NSAttributedString.Key.foregroundColor: UIColor.red
]
)

如果我尝试更改背景颜色,它也会变成灰色。也许有人已经遇到过这个问题?

最佳答案

使用私有(private) API 从来都不是一个好主意,因为它们可能会在没有通知的情况下发生更改。我猜你用的是这样的东西:

actionSheet.setValue(message, forKey: "attributedTitle")

这就是为什么这在 iOS13.3 上不起作用的原因。不幸的是,没有合法的方法可以使用公共(public) API 更改这些颜色。但你是not alonehere很好的推荐

关于ios - 操作表文本始终为灰色(NSAttributedString.Key 不起作用),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59680868/

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