正确推送 NSView

发布于 2024-12-20 12:28:06 字数 439 浏览 2 评论 0原文

我有一个很棒的系统(它可以工作,但可能不是完成任务的正确方法),可以将一个 NSView 动画到另一个 NSView 之上。用户单击一个按钮,一个 NSView 飞入另一个“替换”它。问题出现在调整窗口大小时。由于我的设置方式,一个视图位于不可见的位置并使用 animator 进行动画处理,调整大小几乎是不可能的。我还尝试了这个这看起来很有希望,但未能提供一种处理窗口大小调整的方法(我无法想出一个)。那么如何才能通过良好的过渡来完成交换视图这一看似简单的任务呢?抱歉问了这么长的问题,希望我已经足够清楚地解释了我所拥有的系统。

感谢您的任何帮助/建议

I had a great system (It worked but was probably not the correct way to accomplish the task) going to animating one NSView over another. The user clicked a button and an NSView flew in over the other "replacing" it. The problem came in with window resizing. Due to the way I set it up, one view was sitting in a non-visible location and animating in with animator, resizing was nearly impossible. I also tried this which seemed promising but failed to deliver a method (and I couldn't come up with one) for handeling window resizes. So how can one accomplish the seemingly simple task of swapping views with a nice transition? Sorry for the long winded question and hopefully I explained the system I had clearly enough.

Thanks for any help/advice

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

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

发布评论

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

评论(1

诺曦 2024-12-27 12:28:06

只需将控制器添加为窗口的委托并实现 windowWillResize:toSize: 委托方法即可。

在该方法的实现中,您应该适当地设置屏幕外视图的大小。

Just add your controller as the window's delegate and implement the windowWillResize:toSize: delegate method.

In your implementation of the method you should set the size of your off-screen view appropriately.

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