我尝试对计算器进行编程。但是使用重置按钮,我不断出现以下错误消息:无法将类型为'String'的值分配给type UILabel?
。
我已经尝试更换label
用label.text
。
这是我的一些代码。错误消息出现在后面 label
if sender.tag == 11 {
label = " "
previousNumber = 0;
numberOnScreen = 0;
}
如果您将您label
声明为Label?
,请尝试:
if let realLabel = label {
realLabel.text = " "
} else {
print("There is no label")
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句