在 NSSearchField 内显示进度指示器

发布于 2024-09-15 23:55:18 字数 160 浏览 5 评论 0原文

我正在使用 NSSearchField 通过互联网运行查询并在表视图中显示结果。当查询运行时,我想在 NSSearchField 内显示进度指示器?我想我以前在另一个应用程序中见过这样做。

是否有一个开源组件可以用来完成此任务?

我该怎么做呢?最好的方法是什么?有哪些陷阱?

I am using a NSSearchField to run a query over the internet and display the results in a table view. Whilst the query is running I would like to display a progress indicator inside an NSSearchField? I think I have seen this done in another application before.

Is there an open source component that I could use to accomplish this?

How would I go about doing this? What is the best way? What are the pitfalls?

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

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

发布评论

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

评论(3

把回忆走一遍 2024-09-22 23:55:18

最简单的方法是将进度指示器放在搜索字段上方(顶部),并将它们保留为单独的视图。过去,视图 z 排序会产生不可预测的结果,因此不被鼓励。现在,对于几个 OS X 版本来说,情况并非如此,因此,如果它看起来不错并且性能符合预期,我建议就使用它。

更困难的方法是继承 NSSearchField 并根据 Cocoa 指南的控制和单元编程主题

The easiest way is to put the progress indicator above (atop) the search field and leave them as separate views. It used to be that view z-ordering would give unpredictable results and weren't encouraged. That's not been true for several OS X versions, now, so if it looks good and behaves as expected, I say go for it.

The harder way would be to subclass NSSearchField and muck around according to the goodies found in the Control and Cell Programming Topics for Cocoa guide.

迷爱 2024-09-22 23:55:18

我会选择 UISearchFieldCell 的自定义子类。找到绘制背景的方法并尝试在其中添加自定义绘制代码。我不想摆弄嵌套组件。我想safari中用的也是自定义控件。

I'd go for a custom subclass of UISearchFieldCell. Find the method that draws the background and try to add your custom drawing code there. I'd rather not fiddle with nested components. I think the one used in safari is also a custom control.

脱离于你 2024-09-22 23:55:18

这不是我的解决方案,但我遇到了这个问题,我最终找到了一个解决方案并且它对我有用:

https://github.com/owainhunt/UAShared/blob/master/UAShared/NSSearchField%2BSpinner.m

This is not my solution but I came across this question and I eventually found someone that worked out a solution and it worked for me:

https://github.com/owainhunt/UAShared/blob/master/UAShared/NSSearchField%2BSpinner.m

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