nstokenfieldcell

NSTokenField: different colors for tokens

被刻印的时光 ゝ 提交于 2021-02-08 05:19:13
问题 I have created an NSTokenField in my xib. I'd like to display tokens with different colors inside that tokenField. Meaning: some tokens will be blue, the rest will be red (according to their content). Is that possible? The following code doesn't work for me. I hope someone can help me out: - (id)tokenField:(NSTokenField *)tokenField representedObjectForEditingString:(NSString *)editingString { id returnRepresentedObject = nil; NSTokenFieldCell *tf = [[NSTokenFieldCell alloc] init]; tf