CBAutocompleteTextField
子类 NSTextField
并重写该方法:
- (void)textDidChange:(NSNotification *)aNotification
{
[self complete:nil];
[super textDidChange:aNotification];
}
我没有收到任何警告,但出现运行时错误:
[CBAutocompleteTextField complete:]: unrecognized selector sent to instance 0xca19a50
为什么? NSTextField
是 NSResponder
的子类,它提供了这种方法。事实上我没有收到警告。
谢谢
最佳答案
根据文档,除非您提供覆盖,否则该方法将不起作用:
This method can be interpreted, for example, as a request to attempt expansion of a partial word, such as for expanding a glossary shortcut, or to close a graphics item being drawn.
NSResponder
declares but doesn’t implement this method. (emphasis added)
关于objective-c - [CBAutocompleteTextFieldField完成:]: unrecognized selector sent to instance?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19858811/