NSTrackingArea 和性能

发布于 2024-12-17 09:24:48 字数 273 浏览 3 评论 0原文

我有一个 NSTrackingArea 来确定是否应该在我的视图中显示关闭“按钮”。我想显示翻转图像。

更好的是,

  • 实际上使用一个按钮(作为子视图)而不是绘制我自己的东西,然后向按钮添加另一个跟踪区域,然后显示翻转图像。
  • 使用 第二 NSTrackingArea 来确定何时鼠标位于关闭按钮的顶部,因此我可以显示翻转图像。

我个人认为第二个更容易,我唯一需要做的额外的事情就是按钮为我做的就是实现点击操作。

I have a NSTrackingArea to determine whether I should show a close "button" in my view. I would like to show a rollover image.

What is better,

  • Actually using a button ( as a subview ) instead of drawing my own thing, then adding another tracking area to the button and then showing the rollover image..
  • Using a second NSTrackingArea to determine when the mouse is on top of the close button so I can show the rollover image.

I personally think the second one is easier, the only thing that I would have to do extra what the button would do for me is implementing a click action.

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

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

发布评论

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

评论(1

淡淡的优雅 2024-12-24 09:24:48

使用对您来说最容易实施的方法。两者都不太可能导致任何性能问题(NSTrackingArea 已经高度优化。)

Use whichever approach is simplest for you to implement. It is extremely unlikely that either will cause any performance problems (NSTrackingArea is already highly optimized.)

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