TopMenuController というクラスを作成しました。これでアプリのメイン メニューの IBActions を処理したいと思います。クラスをリンクし、以下を正常に出力しました。
- (IBAction)about:(id)sender {
NSRunAlertPanel(@"string1", @"hi", @"OK", @"Cancel", @"other button");
}
しかし、私はしたいです。そして、これが私が間違っているところです。
- (IBAction)about:(id)sender {
NSAlert *aboutPopUp = [NSAlert alertWithMessageText:@"message1"
defaultButton:@"OK"
alternateButton:@"cancel"
otherButton:@"otherbutton"
informativeTextWithFormat:@"hello"];
[aboutPopUp beginSheetModalForWindow:_Window
modalDelegate:Nil
didEndSelector:Nil
contextInfo:Nil];
}
beginSheetModalForWindow: は AppDelegate.h/m からのメイン ウィンドウを指す必要があり、TopMenuController.m でメイン ウィンドウを参照できないようです。
beginSheetModalForWindow:Nil <-- を設定すると、ポップアップ ウィンドウが表示されます (ただし、求めていた効果は得られません)。
エラーは beginSheetModalForWindow:_Window (宣言されていない識別子) です
誰でも助けてもらえますか?これをグーグルで検索しようとしましたが、何をグーグルで検索すればよいかわかりません。