-
0 votesanswersviews
unwrapping button.titleLabel.text
我需要将按钮的文本与变量进行比较 . @IBAction func CheckifATrue(sender: AnyObject) { if let thisbutton = sender.titleLabel.text { if thisbutton == theAnswer.text { score++ println(&... -
-2 votesanswersviews
'Unexpectedly found nil while unwrapping an Optional value'
我想做一个只有在触摸按钮时才会出现的标签 . 当在MainViewController中调用函数 hidden() 时它's working well but when i'从ButtonAction类调用它(相同的函数)我得到一个经典错误: 在解开Optional值时意外发现nil 这是代码: // MainViewController.swift import UIKit class...