gpt4 book ai didi

ios - swift 中文本字段的前景色

转载 作者:搜寻专家 更新时间:2023-11-01 07:07:29 24 4
gpt4 key购买 nike

亲爱的,

我正在快速学习并且正在尝试为文本字段文本着色,现在的问题是颜色未应用于文本。请找到下一个代码:

     let textStyle:[String:Any] = [
NSAttributedStringKey.strokeColor.rawValue: UIColor.black,
NSAttributedStringKey.foregroundColor.rawValue: UIColor.white,
NSAttributedStringKey.font.rawValue: UIFont (name: "Impact", size: 50)!,
NSAttributedStringKey.strokeWidth.rawValue: 3.5
]

谢谢

最佳答案

关键似乎是 .strokeWidth...如果您想要描边和填充,描边宽度需要是一个负数值。

试一试:

    let textStyle = [
NSAttributedStringKey.strokeColor: UIColor.black,
NSAttributedStringKey.foregroundColor: UIColor.white,
NSAttributedStringKey.font: UIFont(name: "Impact", size: 50)!,
NSAttributedStringKey.strokeWidth: -3.5
]

关于ios - swift 中文本字段的前景色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47159728/

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