6

I have saveWindowController (NSWindowController subclass object). I use initWithWindowNibName: method to init the controller.
I set File's owner in xib to SaveWindowController. I connect delegate (from window) to File's owner and window (from controller) to NSWindow in xib file.

[NSApp beginSheet:[self.saveWindowController window] 
   modalForWindow:[self window]
    modalDelegate:nil didEndSelector:nil contextInfo:nil];

After executing this method I see modal window without titlebar and it appears not like normal sheet. It just appears in left bottom corner of first window.

Could you help me, what I'm doing wrong?

Anoop Vaidya
  • 46,283
  • 15
  • 111
  • 140
Lloyd18
  • 1,679
  • 1
  • 18
  • 28

2 Answers2

19

Do you have your SaveWindowController's window set to "Visible at Launch" in the XIB? You must uncheck that option, or your window will try to display as soon as the XIB is loaded, and will not be positioned correctly.

Francis McGrew
  • 7,264
  • 1
  • 33
  • 30
  • Any suggestions on where I can learn stuff like this? I couldn't figure out what's going on until I came across this thread.... – Robert Kang Jun 20 '12 at 14:57
  • The Apple docs about window sheets have a screenshot showing this. Admitted, this isn't the most prominent of all places to put that info. – ctietze Jul 15 '16 at 06:46
0

I had a lot of trouble before realizing I declared my sheet window in IB without title bar. Does yours has one? If not, check the "title bar" option.

B.

berfis
  • 417
  • 4
  • 17