2

I'm trying to get an NSTokenField working that allows editing to a similar post here.

The answer that was provided gave me the key but something is still off. What should the token character set be set as? My tags will be in this format "< token text >". Setting the character tokenizer to " " results in the " " between words being removed.

What should I be using as the token character set? This is driving me crazy!

Community
  • 1
  • 1
Tim D.
  • 119
  • 10

1 Answers1

0

I haven't tried this, but I would use " " as the tokenizer and then add a space at the end of your display string which is not in your editing string.

So -tokenField:displayStringForRepresentedObject: would return "Hello " and -tokenField:editingStringForRepresentedObject: would return "Hello".

The alternative would be using "<" and ">" as the tokenizing characters, but I could see a lot of potential issues arising from that.

Jon Hull
  • 679
  • 6
  • 15
  • 1
    It appears that may work, I was able to solve my issue by using "" as the tokenizer and responding to key events and handling them according and modifying the objectValue. – Tim D. Jan 10 '12 at 00:20
  • That actually works very well, but the problem is it doubles the " " character in between tokens. Weird behavior. – Tim D. Jan 10 '12 at 01:29