当前位置: 动力学知识库 > 问答 > 编程问答 >

cocoa - Why can't I make an NSOpenPanel as key window?

问题描述:

Here is the code.

NSOpenPanel *panel = [NSOpenPanel openPanel];

......

[panel runModal];

[panel makeKeyWindow];

But it doesn't work, I don't know what is going wrong.Here is the screenshot.

After I click the panel to make it keywindow manually, it shows like this:

网友答案:

Thanks to rob mayoff.

Now I put

[NSApp activateIgnoringOtherApps:YES];

right after

[openPanel beginSheetModalForWindow: nil completionHandler: ^(NSInteger result){......}];

Everything works like a charm.

分享给朋友:
您可能感兴趣的文章:
随机阅读: