NSTextField 添加取消按钮
使用 iOS 和 UISearchBar,您可以在文本字段中设置一个漂亮的小取消按钮,类似于:
(请注意,我在另一篇文章中找到了该图像,并且“啊!”与我的情况无关)。
现在就我而言,我使用可可和 NSTextField,我想知道添加类似内容的最简单方法是什么。最糟糕的情况是,我将创建一个带有图像/按钮的自定义 NSTextField,但如果我缺少一种明显的方法来执行此操作,我宁愿不重新发明轮子。
Using iOS and a UISearchBar you can have a nice little cancel button setup within the text field similar to this:
(Note I found the image on another post and the 'argh!' is not relevant in my case).
Now in my case i'm using cocoa and a NSTextField and i'm wondering what the easiest way to have something similar added would be. Worse case scenario I will create a custom NSTextField with an image/button on it, but I would prefer to not reinvent the wheel if I am missing an obvious way to do this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不知何故忽略了
NSSearchField
组件,它基本上正是这样做的。I somehow overlooked the
NSSearchField
component which does basically exactly this.