Multiple XIB/NIB files: IBOutlets not connecting
I have two UIViewController subcl开发者_如何学编程asses, A and B.
In A.xib I have embedded a "B" UIViewController, set its NIB Name as "B", and attached its delegate and IBActions to the File's Owner, which is an A.
In B.xib I have defined a view and attached its various IBOutlets to the File's Owner, which is a B.
In the graphic you can see the two XIBs, A on the left and B on the right. In each XIB there appears an entity whose Type is a "B" UIViewController (in the right file it's the File's Owner). It makes sense to hook up some references and outlets in the left XIB (eg. delegate), and some on the right (eg. view components).
The unhappy result is that in viewDidLoad:, only the outlets/actions/references defined in the left file (A.xib) are connected.
What is the correct way of doing this? I can make it work in code — explicitly creating the "B" UIViewController, inserting its view, hooking up its delegate — but I am trying for the "right" approach using Interface Builder.
Although other questions on stackoverflow refer to multiple xib/nib IBOutlet connection problems, somehow none of them seem to address this situation.
精彩评论