-3
我連接了UILabel
和UIButton
,但仍然中止。請幫我解決這個問題。爲什麼這會在UIlabel上放棄?
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
counterLabel.text = "0"
// Do any additional setup after loading the view, typically from a nib.
}
var counterNum: Int = 0
@IBOutlet weak var counterLabel: UILabel!
@IBAction func Tap(_ sender: UIButton) {
self.counterNum += 1
self.counterLabel.text = String(self.counterNum)
}
}
究竟是什麼問題?你有沒有崩潰日誌? – Larme
爲什麼包含'func didReceiveMemoryWarning'?請僅爲您的問題添加_relevant_代碼。 –
當它中止時,Xcode會顯示什麼? –