On Mar 3, 2011, at 12:31 PM, Uli Kusterer wrote: > On 02.03.2011, at 10:54, Andreas Grosam wrote: >> I have a very basic custom UIViewController with its own associated nib >> file. This view controller is the "root view controller" of a Navigation >> Controller which is itself embedded within a Split View Controller which is >> defined in another nib - say the main.nib. > > tl;dr > > But do you have any objects that are part of several NIBs? I.e. a view > controller that is instantiated by one NIB, but the view controller has a NIB > of its own that it loads in turn? In that case, you'll get -awakeFromNib > twice. Once when the containing NIB is instantiated, and a second time after > you load the containED NIB.
No, there is just two nib files, the main.nib and the RootViewController.nib. You can easily create this scenario from a template project in Xcode. For iOS use a Navigation Based Application. The "main.nib" is defined as follows: File's Owner UIApplication First Responder App Delegate NavigationBasededAppDelegate Window Navigation Controller Navigation Bar Root View Controller RootViewController -> Nib Name = "RootViewController.nib" Note: "Root View Controller" isn't embedded within the main.nib, instead it has its own nib "RootViewController.nib". In order to reference the nib file from within the main nib, the "nib Name" property of the Root View Controller (within the main.nib) is defined and its value is "RootViewController" - which shall be the nib for this object. In order to create this in a sample, you need to define an outlet in the root view controller, e.g.: @interface RootViewController ... { IBOutlet UIView* testView; } @property (nonatomic, retain) IBOutlet UIView* testView; @end Then, in IB, add this view and connect the outlet as appropriate. Then, the "RootViewController.nib" is defined as: File's Owner RootViewController First Responder Table View Test View The RootViewController has an Outlet 'testView' which references "Test View" within the same nib (RootViewController.nib). When -awakeFromNib is sent to the root view controller, the outlet 'testView' is not connected. The message is sent during *loading the main nib*. The root view controller does not receive another -awakeFromNib message. Andreas _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com