我遇到了iOS 9简单应用的问题。
当我按下计算按钮时,应用程序关闭,它不会更改标签的文本。
我做错了什么?
class ViewController: UIViewController {
@IBOutlet weak var weightTextField: UITextField!
@IBOutlet weak var repsTextField: UITextField!
@IBOutlet weak var resultsLabel: UILabel!
@IBAction func calculateButton(sender: AnyObject) {
let numberOfReps = Double(repsTextField.text!)!
let weight = Double(weightTextField.text!)!
let x = (numberOfReps * 0.033)
let x1 = (x + 1)
let max = (weight * x1)
let oneMaxRepString = Double(max)
resultsLabel.text = String(oneMaxRepString)
}
}