0

i am new to mac development. I have created an app which contain two window controller. second window launches on on first window button click. now i want to keep second window in front till it is not closed and first window not be able to userinteractive till second window closed

  • See http://stackoverflow.com/questions/5364460/keep-nswindow-front or http://stackoverflow.com/questions/6723578/nswindow-show-new-window-that-will-always-stay-on-top-of-current-window – Vikram Singh Apr 19 '14 at 10:13
  • You mean you want the second window to be modal. – uchuugaka Apr 19 '14 at 11:05

1 Answers1

0

To make the second window appear in front of the first window and prevent the user from interacting with the first window add runModalForWindow:(NSWindow *) in the windowDidLoad of your second window controller. The code should look kind of like this:

- (void)windowDidLoad {
    [super windowDidLoad];

    //Whatever code you have put in your windowDidLoad method

    [NSApp runModalForWindow:_browserWindow];  
}
MacUserT
  • 1,760
  • 2
  • 18
  • 30