如何将 [UILabel] 的集合转换为字符串文本以显示在 ViewController 上?
How do I convert Collection of [UILabel] to string text to display on ViewController?
我试图在 [UILabel]
的集合上显示相同的信息,但出现此错误
Value of type '[UILabel]?
' has no member 'text'
我在我的代码中的这一行收到特定错误。
storagetypelabel.text = "\(booking.storageType.uppercased()) STORAGE"
想知道如何改变我的 property.text 标签的输入方式。
由于我将多个 UILabel
连接到一个 [UILabel]
集合,当我调用 [UILabel]
属性 时,我应该能够为所有对象显示相同的信息集合中连接的标签对吗?
text
是单个 UILabel
的 属性 而不是数组,要为所有标签设置文本,请使用
let str = "\(booking.storageType.uppercased()) STORAGE"
storagetypelabel.forEach { [=10=].text = str }
我试图在 [UILabel]
的集合上显示相同的信息,但出现此错误
Value of type '
[UILabel]?
' has no member 'text'
我在我的代码中的这一行收到特定错误。
storagetypelabel.text = "\(booking.storageType.uppercased()) STORAGE"
想知道如何改变我的 property.text 标签的输入方式。
由于我将多个 UILabel
连接到一个 [UILabel]
集合,当我调用 [UILabel]
属性 时,我应该能够为所有对象显示相同的信息集合中连接的标签对吗?
text
是单个 UILabel
的 属性 而不是数组,要为所有标签设置文本,请使用
let str = "\(booking.storageType.uppercased()) STORAGE"
storagetypelabel.forEach { [=10=].text = str }