5

I am new to Cocoa programming.

I have a main NSWindowController and would like to open a second sub NSWindowController. can't seem to find the code anyway.

Can anyone help?

Regexident
  • 29,441
  • 10
  • 93
  • 100
Jason
  • 1,059
  • 1
  • 13
  • 32

1 Answers1

4

not sure if this is correct but i got this working as this is new for me as well

in the AppDelegate file i have

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
    // Insert code here to initialize your application

    QuickBookingViewController * viewController = [[QuickBookingViewController alloc ] initWithNibName:@"QuickBookingViewController" bundle:nil];

    SimpleWindow *myWindow = [[SimpleWindow alloc] initWithWindowNibName:@"SimpleWindow"];

    [self.window addChildWindow:[myWindow window] ordered:NSWindowBelow];

}

that seems to open up my view controller

recently i got this code from SO

   SimpleWindow *myWindow = [[SimpleWindow alloc] initWithWindowNibName:@"SimpleWindow"];

    [myWindow showWindow:nil];
    [[myWindow window] makeMainWindow];
ssmithstone
  • 1,219
  • 1
  • 10
  • 21
  • For me, the edited code initializes two window controllers instead of one. initWithWindowNibName initializes one, then, then showWindow initializes another but gives me no pointer to it! – sudo Oct 09 '13 at 00:34