UILabel not updating

后端 未结 5 1224
太阳男子
太阳男子 2021-01-02 10:38

Sorry the basic question, but this bugs me for a while now.

I create a details view from a UITable and try to dynamically set its labels, but they are not updating:

5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-02 11:26

    Not sure but I think this is what's going on:

    When the view is pushed, the controller loads the view from the nib and hooks up the actions and outlets. Before this, the outlets are not connected, so tmpVC.myLabel is nil.

    If you want to be sure, you could put a breakpoint in viewDidLoad of tmpVC to see when the view is loaded.

提交回复
热议问题