我可以创建一个 find & 吗?替换早于 Lion 的 Mac OS 版本中的栏?

发布于 2024-11-28 10:00:41 字数 677 浏览 8 评论 0原文

我想在我的应用程序的 NSTextView 中添加一个查找栏(就像 Safari、Skim 等中出现的那样)。

我想使用 NSTextView 的 setUsesFindBar 方法,但目前它只是 Lion 的 API(根据其文档)。它使用 NSTextFinder 类,该类也仅在 Lion 中可用。

我的问题是如何在需要在 Snow Leopard 和 Lion 上运行的应用程序中复制此操作。我当然可以使用 SL 上的查找面板,但如果两个版本的外观保持一致那就太好了。

Safari、Skim 等应用程序是否在其 SL 版本中从头开始编码?

任何解释或指示将不胜感激。

I'd like to add a find bar (just like the one that appears in Safari, Skim, etc) in the NSTextView of my app.

I'd like to use NSTextView's setUsesFindBar method, but it's a Lion only API at the moment (according to its documentation). It uses the NSTextFinder class, which is also available only in Lion.

My question is how I may be able to replicate this in my app that needs to run on both Snow Leopard and Lion. I could of course use the find panel on SL, but it would be nice to have a consistent look across the two versions.

Are apps like Safari, Skim and so on coding it from scratch in their SL versions?

Any explanations or pointers would be much appreciated.

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

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

发布评论

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

评论(1

随遇而安 2024-12-05 10:00:41

不幸的是,您需要从头开始为 Snow Leopard 实现查找栏,它没有 API 支持。 Safari 可能在 Snow Leopard 中使用此 API 的私有实现(我不知道是否这样做),但 Skim 的开发人员很可能从头开始重新实现它。

我认为让 Lion 用户使用新功能,而 SL 用户使用旧的查找面板是处理这种情况的适当方法。我个人认为不值得为旧操作系统重新实现它。

更新:我刚刚搜索了 Skim,它似乎是 开源。如果您指的是 Skim 应用程序,那么只需查看源代码并亲自查看即可。

Unfortunately, you'd need to implement the find bar from scratch for Snow Leopard, there's no API support for it. Safari may use a private implementation of this API in Snow Leopard (I don't know if it does or not) but the developer of Skim has most likely re-implemented it from scratch.

I think that letting Lion users make use of the new functionality while SL users get the old find panel is an appropriate way of dealing with the situation. I don't personally think it's worth going to the effort of re-implementing it for a legacy OS.

Updated: I just did a search for Skim and it appears to be open source. If that is the Skim app you're referring to, then just check out the source and have a look for yourself.

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