Max Yankov
Max Yankov

Reputation: 13277

Adding custom subview in IB

I have two nib files: the main application window, and a small view that I want to use in it. How can I insert instance of this view into the main window using interface builder?

Upvotes: 0

Views: 289

Answers (1)

rdelmar
rdelmar

Reputation: 104082

You can't. If you want a small view in your main application window, just drag a custom view object onto your window in the main nib.

You can add your second nib view to your main window, but that has to be done in code. The usual way to do that is to add a new file to your project that's a subclass of NSViewController -- you will get a new xib file with this that has a view. Then you would alloc initWithNibName:bundle: to create an instance of your view controller, and add its view to your main window's contentView.

Upvotes: 1

Related Questions