mort
mort

Reputation: 790

Show a second window from a second .xib file in Xcode?

I am a complete noob with Xcode, but I am trying to make a small Mac application. What I want happen, is that I press a button in the main window, and another window opens on top of that main window. As I said, I am a complete noob, so I would prefer a step by step guide :)

Upvotes: 1

Views: 1971

Answers (1)

aleroot
aleroot

Reputation: 72636

It is quite simple, first of all you have to create a window with Xcode, then a WindowController after that you can link the Controller with your view(the Xib). Then to open up a new window (lets say your window controller is called YourWindowController) just insert this code in the IBAction method that get fired by your button :

YourWindowController *controllerWindow = 
[[YourWindowController alloc] initWithWindowNibName:@"You_Window_XIB"];
[controllerWindow showWindow:self];

Upvotes: 2

Related Questions