IBOutlet instances are (null) after loading from NIB

前端 未结 5 1982
太阳男子
太阳男子 2021-02-18 22:30

I am working on an iPhone app and am getting (null) references to IBOutlet fields in my controller. I have a UIViewController subclass that is set as the File\'s Owner in my XIB

5条回答
  •  耶瑟儿~
    2021-02-18 22:43

    Make sure the view property of your view controller (ie File's Owner in this case) is wired to the view in your xib. As your textField is almost certainly a subview of that, it's important to get that wired in too (and I don't think the nib will load properly without that being set).

提交回复
热议问题