轻松将 NSComboBox 转换为 NSTextField
我有一个 NSComboBox,我想知道是否有一种简单的方法将其转换为普通的 NSTextField?考虑到 NSCombBox 是 NSTextField 的子类,我认为有一种简单的方法可以打开/关闭它,但我无法弄清楚。
I have an NSComboBox and I was wondering if there is an easy way to convert it to an ordinary NSTextField? Considering NSCombBox is a subclass of NSTextField, I would think there is an easy way to turn this on/off but I can't figure it out.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它们是两个独立的控件。您只需将其中一个换成另一个即可。如果您希望在设计时在 Interface Builder 中执行此操作,那么它非常简单。如果您希望在代码中执行此操作,那么这并不太困难(特别是如果您已经在 XIB 中的某个位置创建并配置了两个控件,例如离屏视图)。
它可能有助于描述您想要完成的任务(即为什么要交换控件)。如果没有更多有关您目标的信息,很难给出简洁的答案。
They are two separate controls. You'll just have to swap one out for the other. If you're looking to do this in Interface Builder at design time, it's mind-numbingly simple. If you're looking to do this in code, it's not overly difficult (especially if you already have both controls created and configured somewhere in your XIB, like an off-screen view).
It might help to describe what you're trying to accomplish (ie, why you want to swap the controls). It's difficult to give a succinct answer without more information about your goals.