TheAmateurProgrammer
TheAmateurProgrammer

Reputation: 9392

How to invoke a NIB file through a menubar item?

I'm sorry if this questions a bit basic, but how do you invoke a nib file through a button or a menubar item? What would the method be?

Upvotes: 0

Views: 92

Answers (1)

walter
walter

Reputation: 364

I'm not sure what you mean by "invoke" a nib file, but if you want to dynamically load a nib file, you can use an NSBundle method:

[NSBundle loadNibNamed:@"MyNib" owner:object];

Here you're loading the a nib resource that's in your app bundle called "MyNib". The file's owner of the nib is set to "object". In Interface Builder, you'll want to set the class for the File's Owner to be the same as "object"

More info here: http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/LoadingResources/CocoaNibs/CocoaNibs.html%23//apple_ref/doc/uid/10000051i-CH4-SW8

Upvotes: 2

Related Questions