正确推送 NSView
我有一个很棒的系统(它可以工作,但可能不是完成任务的正确方法),可以将一个 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只需将控制器添加为窗口的委托并实现
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.