开发者

NSApp beginSheet creates a sheet very briefly then disappears

开发者 https://www.devze.com 2023-03-28 17:43 出处:网络
[NSApp beginSheet] is used like so: [NSApp beginSheet:[testSheetController window] modalForWindow:[NSApp mainWindow]

[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 su开发者_如何转开发ggest 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消