-5

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)")
    }
}
4

1 回答 1

2

您的代码中没有任何内容表明标签具有标签 1。您应该转到情节提要并检查标签是否具有标签 1 或以编程方式设置标签

于 2017-02-12T13:43:49.967 回答