I think it is a bug of OSX 10.9
.
Here is what I did. The screen:
(the textField
is a NSTokenField
)
Then, in a delegate for this NSTokenField
, put the following code
- (NSArray *) tokenField:(NSTokenField *)tokenField
completionsForSubstring:(NSString *)substring
indexOfToken:(NSInteger)tokenIndex
indexOfSelectedItem:(NSInteger *)selectedIndex
{
return @[@"Jojo!!"];
}
- (id) tokenField:(NSTokenField *)tokenField
representedObjectForEditingString:(NSString *)editingString
{
return @"Jojo the cat" ;
}
- (NSString *) tokenField:(NSTokenField *)tokenField
displayStringForRepresentedObject:(id)representedObject
{
return @"Jojo" ;
}
You'll see, it bugs.