activite1Label作为标签1
class StatsViewController: UIViewController {
@IBOutlet weak var activite1Label: UILabel!
@IBOutlet weak var activite2Label: UILabel!
@IBOutlet weak var activite3Label: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
activite1Label.text = activite[0]
activite2Label.text = activite[1]
activite3Label.text = activite[2]
miseAjourTotal()
}
func miseAjourTotal() {
let leLabel = view.viewWithTag(1) as! UILabel
print("leLabel: \(leLabel.text)")
}
}
答案 0 :(得分:2)
您的代码中没有任何内容告诉标签有标签1.您应该转到故事板并检查标签是否有标签1或以编程方式设置标签