Objective c cocos2d mac项目警报窗口在全屏模式下位于主窗口下方

Objective c cocos2d mac项目警报窗口在全屏模式下位于主窗口下方,objective-c,macos,cocos2d-iphone,fullscreen,Objective C,Macos,Cocos2d Iphone,Fullscreen,我在mac游戏中使用cocos2d。在全屏模式下,警报窗口位于主窗口下方,因此无法单击。这是我的密码: NSAlert* alert = [[NSAlert alloc] init]; alert.alertStyle = NSWarningAlertStyle; [alert addButtonWithTitle:[Helper getLocalizedStringWithString:@"ok"]]; alert.messageText = [Helper getLocalizedStrin

我在mac游戏中使用cocos2d。在全屏模式下,警报窗口位于主窗口下方,因此无法单击。这是我的密码:

NSAlert* alert = [[NSAlert alloc] init];
alert.alertStyle = NSWarningAlertStyle;
[alert addButtonWithTitle:[Helper getLocalizedStringWithString:@"ok"]];
alert.messageText = [Helper getLocalizedStringWithString:@"you need to play through classic game and expert mode"];

switch ([alert runModal]) {
    case NSAlertFirstButtonReturn:
        break;

    default:
        break;
}    

[alert release];
我已尝试将
[alert window]
s zOrder设置为MaxInteger,但仍然没有显示在顶部


这里有什么问题吗

我将使用NSAlert的方法来展示它:

- (void)beginSheetModalForWindow:(NSWindow *)window modalDelegate:(id)modalDelegate  
    didEndSelector:(SEL)alertDidEndSelector contextInfo:(void *)contextInfo;
所以你肯定会看到它,因为它是贴在窗户上的

编辑

如果仍希望将其作为单独的面板,请尝试以下操作:

[[NSRunningApplication currentApplication] activateWithOptions:NSApplicationActivateIgnoringOtherApps];
[alert runModal];

事实上,我还是更喜欢分开窗口的方法。无论如何,工作表模式不是坏的,也许你仍然可以用一个单独的面板运行它,并把它放在顶部。试试我在编辑中添加的代码。