テキスト フィールドに入力しているユーザーに有効な構文を示す IntelliSense スタイルのポップオーバーの作成に取り組んでいます。ユーザーが textField に引き続き入力できるように、フォーカスを与えずに NSPopover を表示する方法を知っている人はいますか? ポップオーバーは controlTextDidChange によってトリガーされます。
- (void) controlTextDidChange:(NSNotification *)obj
{
NSTextField *field = [obj object];
NSString *command = [field stringValue];
if ([[command substringFromIndex: command.length - 1] isEqualToString: @"#"]){
CompletionMenuController *completionController = [[CompletionMenuController alloc] initWithNibName: @"CompletionMenuController" bundle:[NSBundle mainBundle]];
completionMenuPopover = [[NSPopoverInformation alloc] init];
[completionMenuPopover setContentViewController: completionController];
[completionMenuPopover setContentSize: completionController.view.frame.size];
[completionMenuPopover setBehavior: NSPopoverBehaviorTransient];
[completionMenuPopover setAppearance: NSPopoverAppearanceHUD];
[completionMenuPopover showRelativeToRect:[_commandBar frame] ofView:_commandBar preferredEdge:NSMaxYEdge];
}
}