NSTokenField
takes quite a time to propose suggestion to the text I enter.
More precisely, here is what happens:
- I type the letter "a"
- the method
textDidBeginEditing:
ofNSTokenField
is called immediately - some time (approx. 1/2 to 1 second)
- the method
tokenField:completionsForSubstring:indexOfToken:indexOfSelectedItem:
is called and its execution is very quick.
I would like to understand what happens and possibly improve this situation.
My question:
What does happen between textDidBeginEditing:
and tokenField:completionsForSubstring:indexOfToken:indexOfSelectedItem:
?
EDIT
Very strange: if I type ";" instead of "a", it goes much quicker! even though I did the following:
- (NSArray *) tokenField:(NSTokenField *)tokenField
completionsForSubstring:(NSString *)substring
indexOfToken:(NSInteger)tokenIndex
indexOfSelectedItem:(NSInteger *)selectedIndex
{
return @[@"Hello"];
}
I think it is a bug of
OSX 10.9
.Here is what I did. The screen:
(the
textField
is aNSTokenField
)Then, in a delegate for this
NSTokenField
, put the following codeYou'll see, it bugs.