My application has a main nib defined in the info.plist.
This nib includes a UIViewController object. In IB, in the attributes inspector, I specify a NIB name with the view for this controller.
I had assumed that loading the main nib would in turn load the view controller’s NIB and everything would be populated. I thought thats the way it has been working. But now in iOS5.1, the view controller object is present after application loading, but its outlets, set in its own NIB, are NOT set.
If I display that view, by getting the view from the controller and adding it to the window, then the outlets are populated. But until then they are all nil.
What am I doing wrong? Has this behavior changed?
I believe what you are seeing is normal. Usually, the first place where it’s safe to assume outlets have been filled in is the view controller’s viewDidLoad:. That normally happens when the controller is given the screen (push, present…). I’m used to code that causes a premature load by referencing the controller’s view explicitly, so I don’t think this is new.