我在我的应用程序中有一个 NSTokenField
,我实现了 tokenField:completionsForSubstring:indexOfToken:indexOfSelectedItem:
方法,在这个方法中我使用 setTokenizingCharacterSet:
方法指定接收器的分词字符集:
def tokenField(tokenField, completionsForSubstring:substring, indexOfToken:tokenIndex, indexOfSelectedItem:selectedIndex)
tokenField.setTokenizingCharacterSet(NSCharacterSet.whitespaceAndNewlineCharacterSet)
end
当我按下空格键或回车键时,它能够按预期工作。我也希望在使用鼠标点击完成列表中的某个项目时能够获得相同的行为。
这有可能实现吗?
谢谢你的帮助。