NSPoover 自定义动画

发布于 2024-12-28 10:03:01 字数 150 浏览 4 评论 0原文

有没有办法为 NSPopover 创建自定义动画?

我可以使用 animates 属性关闭动画,但是由于 NSPopover 是 NSResponder 的子类,而不是正确的视图或窗口,我无法弄清楚如何设置动画我自己。

Is there any way to create a custom animation for NSPopover?

I can switch off the animation by using the animates property, however since NSPopover is a subclass of NSResponder and not a proper view or window I can't figure out how to animate it myself.

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

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

发布评论

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

评论(3

≈。彩虹 2025-01-04 10:03:02

NSPopover 有一个名为 _popoverWindow 的私有属性,类型为 _NSPopoverWindow

_NSPopoverWindowsetAnimates: 方法。您可以使用此方法禁用默认动画,并使用 NSPopoverDelegate 制作 _popoverWindow 的自定义动画。

NSPopover has a private property named _popoverWindow, type of _NSPopoverWindow.

_NSPopoverWindow has setAnimates: method. You can disable default animation using this method, and make a custom animation of _popoverWindow using NSPopoverDelegate.

别低头,皇冠会掉 2025-01-04 10:03:02

弹出窗口将根据其显示的视图进行动画处理。通过以特定方式调整视图大小,将使弹出窗口在调整视图大小时具有动画效果。当然,只有当您想要的动画相当简单并且可以实现到弹出窗口的视图时,这才有效。

The popover will animate depending on the view it is displaying. By just resizing the view in a particular way will make the popover animate while it's resizing the view. Of course, this will only work if the animation you want is fairly simple and can be implemented to the popover's view.

幻梦 2025-01-04 10:03:01

无法连接到 NSPopover 的动画系统。我对接口进行了类转储,它甚至看起来没有任何有用的私有方法。

如果您想要一个自定义的动画弹出窗口,您将需要从头开始实现它(这实际上并不难)。

There is no way to hook into the animation system of NSPopover. I did a class-dump of the interface and it doesn't even look like there are any useful private methods.

If you want a custom animated popover you will need to implement it from scratch (which is not that hard, really).

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