问题描述:

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.

相关阅读:
Top