Hi!
I am trying to override NSTextView - (void)complete:(id)sender
method but I can't find any example on how to do it. What does this method do? There are examples, or where I can find the original implementation?
Thank you!
—Alberto
Hi!
I am trying to override NSTextView - (void)complete:(id)sender
method but I can't find any example on how to do it. What does this method do? There are examples, or where I can find the original implementation?
Thank you!
—Alberto
I believe you should try to do your thing in the delegate with below method instead.
- (NSArray *)textView:(NSTextView *)textView
completions:(NSArray *)words
forPartialWordRange:(NSRange)charRange
indexOfSelectedItem:(NSInteger *)index
One rarely need to subclass in Cocoa. When thinking about it check the delegate methods again.
It's all there in the documentation of complete:
Discussion
…
The delegate may replace or modify the list of possible completions by implementing
textView:completions:forPartialWordRange:indexOfSelectedItem:
. Subclasses may control the list by overridingcompletionsForPartialWordRange:indexOfSelectedItem:
.
Normally, one doesn't need to reimplement complete:
.
Also checkout the SearchField example, especially the implementation.