开发者

How to do a mixed input NSTokenField

开发者 https://www.devze.com 2023-03-02 05:32 出处:网络
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 s

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 remo开发者_如何学运维ved.

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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消