使用字符串值填充 NSPopUpButtonCell

发布于 2024-08-29 01:02:54 字数 256 浏览 6 评论 0原文

我正在尝试使用字符串列表填充 NSPopUpButtonCell。在 -(init) 中,我使用弹出按钮中所需的值填充 NSArray。如何将其连接到我在 IB 中添加的 NSArrayController?我的应用程序委托是否需要 IBOutlet NSArrayController 才能连接,或者是否有办法绑定它?

另外,当我将 NSArrayController 绑定到 NSPopUpButtonCell 时,我将它绑定到哪个内容?内容还是内容价值?

约吉

I am trying to populate a NSPopUpButtonCell with a list of strings. In -(init), I populate an NSArray with the values I want in the PopUp Button. How do I connect this to the NSArrayController I added in IB? Does my app delegate need an IBOutlet NSArrayController to connect to or is there a way to bind it?

Also, when I bind the NSArrayController to the NSPopUpButtonCell, do which Content do I bind it to? Content or Content Values?

jorj

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

家住魔仙堡 2024-09-05 01:02:54

将数组控制器的内容数组绑定到控制器的字符串数组。绑定弹出按钮单元格的 内容内容值 到数组控制器的 arrangedObjects

想必您还想知道选择了这些字符串中的哪一个。为此,请绑定弹出按钮单元格的 选定对象(将是内容中的对象之一)绑定到控制器的属性(拥有原始数组的控制器)。

Bind the array controller's Content Array to your controller's array of strings. Bind both the pop-up button cell's Content and Content Values to your array controller's arrangedObjects.

Presumably, you also want to know which of these strings is selected. To do that, bind the pop-up button cell's Selected Object (which will be one of the objects in Content) to a property of your controller (the one that owns the original array).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文