2

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];

zOrder を MaxIntegerに設定しようとしまし[alert window]たが、まだ上に表示されません。

ここで何か問題がありますか?

4

1 に答える 1

2

この NSAlert のメソッドを使用して提示します。

- (void)beginSheetModalForWindow:(NSWindow *)window modalDelegate:(id)modalDelegate  
    didEndSelector:(SEL)alertDidEndSelector contextInfo:(void *)contextInfo;

窓に取り付けられているので、きっと見えます。

編集

それでも別のパネルとして使用したい場合は、これを試してください:

[[NSRunningApplication currentApplication] activateWithOptions:NSApplicationActivateIgnoringOtherApps];
[alert runModal];
于 2012-12-26T04:07:44.883 に答える