gpt4 book ai didi

objective-c - 从 NSTokenField 获取 token

转载 作者:太空狗 更新时间:2023-10-30 03:21:33 25 4
gpt4 key购买 nike

我可以通过执行 [NSTokenField stringValue] 获取 NSTokenField 的值,但这不会单独返回标记。我想要获取的是数组中的 token 字段,即 ['token', 'token2']

我对 Cocoa/Objective-c 有点无知,所以如果我遗漏了一些明显的东西,我不会感到惊讶。

NSTokenField 不响应 count 所以我不确定是否有可能取回 token 。

谢谢。

最佳答案

来自 the Apple documentation :

To retrieve the objects represented by the tokens in a token field, send the token field an objectValue message. Although this method is declared by NSControl, NSTokenField implements it to return an array of represented objects. If the token field simply contains a series of strings, objectValue returns an array of strings. To set the represented objects of a token field, use the setObjectValue: method, passing in an array of represented objects. If these objects aren’t strings, NSTokenField then queries its delegate for the display strings to use for each token.

关于objective-c - 从 NSTokenField 获取 token ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9490219/

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