[英]Swift Error (EXC_BAD_INSTRUCTION)
super.viewDidLoad()
should be called before you start writing code in the function. 在开始在函数中编写代码之前,应调用
super.viewDidLoad()
。 Basically, the super function is calling the behind-the-scenes viewDidLoad function before you run your own code. 基本上,超级函数在运行您自己的代码之前会调用幕后viewDidLoad函数。
override func viewDidLoad() {
super.viewDidLoad()
TimeLabel.text = "\(counter)"
}
Also, notice the way that I wrote the string. 另外,请注意我编写字符串的方式。 This is called string interpolation and is the correct way to place variables in a string.
这称为字符串插值,是将变量放置在字符串中的正确方法。 For example: "The value is (counter * 2/3)"
例如:“值是(计数器* 2/3)”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.