NSComboBox 到 NSAlert
首先,我对 Objc 有点陌生。 (所以试着像傻瓜一样解释我 XD) 我的问题是:有什么方法可以在 NSAlert 中显示 NSComboBox 吗? 就是这样! 我检查过文档,它说可以显示 NSTextView,但我想知道是否有人以前做过此操作(使用 NSComboBox),代码示例将非常有用!
提前致谢!!!
First of all I'm kind of new in Objc. (so try to explain me like. . . for dummies XD)
Well my question is: Is there any way to show a NSComboBox inside a NSAlert?
that's it!
I've check the documentations, an it says that it is possible to show a NSTextView, but I'm wandering if anyone has done this before (with the NSComboBox), a code example would be really useful!
Thank's in advance!!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可能需要阅读有关
setAccessoryView:
和layout
的文档,网址为 此 URL。我不知道你是否可以在那里插入一个组合框,以及是否可以以某种方式从中获得回报。You might want to read the documentation on
setAccessoryView:
andlayout
at this URL. I don't know if you can insert a combobox there and if you can somehow get a return from it.尤里卡!!!
其实很简单,你只要记住NSButton、NSTextField、NSComboBox就可以了。 。 。 (etc) 继承自 NSView,因此,您只需将所需的对象发送到 NSAlert 中,如下所示:
其中specialtyAlert 是 NSAlert 的实例,specialtyOptions 是 NSComboBox 的实例(但它可以是 NSButton 或任何其他实例) GUI 对象)。
Eureka!!!
is really simple, you just have to remember that NSButton, NSTextField, NSComboBox. . . (etc) inherits from NSView so, you just need to send the object you need into your NSAlert like this:
where specialtyAlert is an instance of NSAlert, and specialtyOptions is an instance of NSComboBox (but it could be an instance of NSButton or any other GUI object).