gpt4 book ai didi

ios - SwiftUI - 类型 'Text' 的值没有成员 'color' 错误

转载 作者:行者123 更新时间:2023-11-28 10:27:14 25 4
gpt4 key购买 nike

我在 Swift UI 代码中遇到错误1)协议(protocol)类型“Any”不能符合“View”,因为只有具体类型才能符合协议(protocol)2) 'Text' 类型的值没有成员 'color'

谁能找到解决方案?

Here is Image What Actual issue is

最佳答案

没有color()这样的修饰符。使用 foregroundColor():

Text("Hello world")
.foregroundColor(.red)

关于ios - SwiftUI - 类型 'Text' 的值没有成员 'color' 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58411454/

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