我看到人们确实像这样
class ViewController1: UIViewController {
let label = UILabel()
override func viewDidLoad() {
self.addSubview(label)
}
}
像这样
class ViewController2: UIViewController {
weak var label: UILabel!
override func viewDidLoad() {
self.label = UILabel()
self.addSubview(label)
}
}
我不明白这两段代码之间有什么区别吗?