【发布时间】:2015-02-28 12:13:50
【问题描述】:
我在调试 UIButton 时遇到了一些问题。有一个错误我不知道如何解决。我几乎可以肯定它在这段代码中的某个地方。这是我的代码:
@IBAction func checkButton(sender: UIButton) {
if (flashButton.hidden == true){
flashButton.hidden == false
flashingImageView.hidden == true
}else if (flashButton.hidden == false)
{
flashButton.hidden == true
flashingImageView.hidden == false
}
if ( "\(randomImageGeneratorNumber)" == "\(currentCountLabel.text)"){
currentAmountCorrect + currentAmountCorrect + 1
amountCorrectLabel.text = "\(currentAmountCorrect)"
}else{
currentAmountIncorrect = currentAmountIncorrect + 1
amountIncorrectLabel.text = "\(currentAmountIncorrect)"
}
if (currentCountLabel.text == "0"){
let alert = UIAlertView()
alert.title = "Alert"
alert.message = "You must type in an answer in order to check it"
alert.addButtonWithTitle("Understood")
alert.show()
}
currentCount *= 0
currentCountLabel.text = "\(currentCount)"
}
调试器输出中的错误说: '[setValue:forUndefinedKey:]: 这个类对于键 CheckButton 不兼容键值编码。'
我不确定如何解决这个问题。有什么建议吗?
提前致谢。
【问题讨论】:
-
检查您的按钮是否在 Interface Builder 中正确连接。
-
连接正确
标签: debugging swift uibutton ibaction