ポップオーバーを開くメニューバー アプリケーションがあります。そのポップオーバーには NSTextField といくつかのボタンが含まれています。問題は、NSTextField が選択不可であり、何も入力できないことです。ただし、マウスの右ボタンでクリックして何かを貼り付けることは可能です。まあ、それは間違いなく奇妙な行動です。ボタンは、そのポップオーバーで問題なく動作します。
私が使用するコードは次のとおりです。
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
[NSApp activateIgnoringOtherApps:YES];
statusItem = [[[NSStatusBar systemStatusBar] statusItemWithLength:NSVariableStatusItemLength] retain];
[statusItem setAction:@selector(showPopOver:)];
[statusItem setImage:[[NSImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"icon" ofType:@"png"]]];
[statusItem setHighlightMode:YES];
}
と:
- (IBAction)showPopOver:(id)sender {
popover = [[NSPopover alloc] init];
[popover setContentViewController:popOverController];
popover.animates = YES;
popover.delegate = self;
[popover showRelativeToRect:[sender bounds]
ofView:sender
preferredEdge:NSMaxYEdge];
}
}
正確に何が問題で、それを修正する方法はありますか?