斯威夫特左侧任务

时间:2018-03-13 14:07:49

标签: swift

class ViewController: UIViewController {
    @IBOutlet weak var display: UILabel?

    var userIsInTheMiddleOfTyping = false

    @IBAction func touchDigit(sender: UIButton) {
        let digit = sender.currentTitle!
        let textCurrentlyInDisplay = display!.text!
        display!.text = textCurrentlyInDisplay + digit

Stanford Swift计算器课程最后display!.text没有解释。我理解之前的let textCurrentlyInDisplay = display!.text!,但为什么作业左侧的display必须有感叹号?

0 个答案:

没有答案