Reasons for an IBOutlet to be nil

前端 未结 6 1955
滥情空心
滥情空心 2021-01-12 13:44

What are the reasons why an IBOutlet (connected) could be nil?

I have one in may application which is always nil, even if I re

6条回答
  •  佛祖请我去吃肉
    2021-01-12 14:12

    Are you using a UINavigationController?
    If so, open your MainWindow.xib in IB and make sure that your root controller's nib name is set correctly in the Attributes Inspector.

    Why would this not be set correctly? One reason is the 'rename' refactoring doesn't update this, and then the internals won't find the nib with which to wire your UI. Or you renamed the nib yourself, and didn't update this field.

提交回复
热议问题