如何做混合输入NSTokenField
我正在尝试让 NSTokenField
工作,允许编辑 到这里的类似帖子。
提供的答案给了我钥匙,但仍有问题。 token字符集应该设置成什么?我的标签将采用“<标记文本>”格式。将字符标记器设置为“”会导致单词之间的“”被删除。
我应该使用什么作为令牌字符集?这让我发疯!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我还没有尝试过这个,但我会使用“”作为标记器,然后在显示字符串的末尾添加一个空格,该空格不在编辑字符串中。
因此 -tokenField:displayStringForRepresentedObject: 将返回“Hello”,而 -tokenField:editingStringForRepresentedObject: 将返回“Hello”。
另一种方法是使用“<”和“>”作为标记化字符,但我可以看到由此产生的很多潜在问题。
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.