如何关闭在我的 NSTextField
(或 NSTextView
)中弹出的自动建议文本?它看起来像这样:
(这可以通过按 esc 手动调出)
最佳答案
对于NSTextField
实现 delegate
方法:- control:textView:completions:forPartialWordRange:indexOfSelectedItem:
以便它返回 null:
-(NSArray *)control:(NSControl *)control textView:(NSTextView *)textView completions:(NSArray *)words forPartialWordRange:(NSRange)charRange indexOfSelectedItem:(NSInteger *)index{
return nil;
}
对于 NSTextView
同理,但方法如下; - textView:completions:forPartialWordRange:indexOfSelectedItem:
来源:http://lists.apple.com/archives/cocoa-dev/2008/Oct/msg02042.html
关于objective-c - 如何在 OS X 中关闭完成提示(NSTextFiled 和 NSTextView),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28522393/