UITextView member variable is always nil in my UIViewController

前端 未结 2 1881
谎友^
谎友^ 2021-01-28 11:25

In my nib, I have a UITextView component.

In my UIViewController I have a UITextView member field and I have used IB to make sure

相关标签:
2条回答
  • 2021-01-28 12:19

    save nib file after connecting outlet, build project and run, it should work if it's connected

    0 讨论(0)
  • 2021-01-28 12:24

    I can't see agere you are calling setText, but I think that you try to do it in the initializer. GUI code should not be done before the viewDidLoad in the case of using XIB's or loadView if you make your GUI programatically, or the other viewWill/viewDid... methods.

    The reason is because the views are not loaded before they are actually needed, it is called lazy loading. You should Google that for more info.

    0 讨论(0)
提交回复
热议问题