[NSApp beginSheet] is used like so:

[NSApp beginSheet:[testSheetController window]
   modalForWindow:[NSApp mainWindow]
    modalDelegate:nil
   didEndSelector:nil
      contextInfo:nil];

Upon execution the sheet appears for a split second, although it is floating and not attached to the window like a sheet normally would, and then disappears. [NSApp mainWindow] is verified to not be nil. No exceptions are produced. Can anyone suggest what might be causing this behaviour?

I'm adding to an existing project and I've been trying to mimic the structure and the creation of other sheet controllers which are working with this window.

有帮助吗?

解决方案

These appear to be two distinct problems: Your sheet probably disappears because it is being released to early. Make sure testSheetController is retained as long as the sheet is visible. The brief flickering in a detached state is likely caused by the Visible at launch property you can turn off when editing the NIB/XIB in Xcode/Interface Builder.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top