gpt4 book ai didi

cocoa - 如何在 NSTokenField 中传递indexofselecteditem

转载 作者:行者123 更新时间:2023-12-03 17:58:58 24 4
gpt4 key购买 nike

我从 tokenField:completionsForSubstring:indexOfToken:indexOfSelectedItem 获得的返回破坏了我输入的项目。这解释了为什么:阅读本文NSTokenField does not let me type other strings than tokenField:completionsForSubstring:… returns回答了我的大部分问题。

在回答时,Jim Correia 说:“因此,如果列表中没有表示子字符串,则您需要将其设置为 -1(否则它将用您第一次完成的文本替换用户输入的文本) ...”在我的例子中,规范是返回 -1 但我不知道如何做到这一点?也许我只是在某个地方错过了它?

谢谢!

最佳答案

重读文档,我终于完成了它。将此添加到 tokenField:completionsForSubstring:indexOfToken:indexOfSelectedItem::

*selectedIndex = -1;

我错过了“按引用返回”位。

关于cocoa - 如何在 NSTokenField 中传递indexofselecteditem,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9381741/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com