Swift 鼠标单击NSTextField autosuggestion时Popover关闭

Swift 鼠标单击NSTextField autosuggestion时Popover关闭,swift,macos,nstextfield,nspopover,Swift,Macos,Nstextfield,Nspopover,我有一个NSViewController,显示为popover,方法如下: optional func control(_ control: NSControl, textView: NSTextView, completions words: [String], forPartialWordRange charRange: NSRange, indexOfSelectedItem index: UnsafeMutablePointer<Int>) -> [String] p

我有一个NSViewController,显示为popover,方法如下:

optional func control(_ control: NSControl, textView: NSTextView, completions words: [String], forPartialWordRange charRange: NSRange, indexOfSelectedItem index: UnsafeMutablePointer<Int>) -> [String]
presentViewController(viewController:NSViewController,asPopoverRelativeTo positioningRect:NSRect,of positioningView:NSView,preferredEdge:NSRectEdge,behavior:nspover.behavior)

该行为设置为瞬态。在popover中,我有一个NSTextField子类,通过使用以下方法提供字符串数组来启用自动完成建议:

optional func control(_ control: NSControl, textView: NSTextView, completions words: [String], forPartialWordRange charRange: NSRange, indexOfSelectedItem index: UnsafeMutablePointer<Int>) -> [String]
可选func控件(control:NSControl,textView:NSTextView,补全词:[String],forPartialWordRange charRange:NSRange,indexOfSelectedItem index:UnsafemtablePointer)->[String]
在NSTextField子类的委托中。到目前为止,自动完成和建议工作正常。但是,每当用户单击建议的字符串时,popover就会消失。但是,当用户通过光标和选项卡选择建议的项目时,popover不会消失。建议列表位于popover内,即建议的视图矩形不突出popover的视图矩形外

我的问题:在这种情况下,我能做些什么来防止popover关闭