核心动画 - 片状窗口滑动 [英] Core Animation - Sheet-like Window Sliding

查看:82
本文介绍了核心动画 - 片状窗口滑动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用核心动画使NSView幻灯片在视图外如何难以使用?一般来说,完成这项工作将涉及什么?我一直在阅读CA文档,但是我很难确定哪些部分与我想做的事情相关,因为我没有框架的经验。


解决方案

因为你在谈论NSView,你可能使用Cocoa的动画支持,而不是直接使用CA。在这种情况下,您只需要通过视图的animator对象设置视图的框架:

  [theView setFrame:offscreenFrame]; 
[[theView animator] setFrame:finalFrame];不幸的是,Cocoa视图动画与CA的更高级功能(例如设置缓动)相互影响,这是非常不利的。。



。你可能有更多的运气使用NSViewAnimation,而不是核心动画支持,并允许一点更多的灵活性。


How difficult would it be to use core animation to make an NSView slide in an out of view like a sheet? Generally speaking, what would be involved in accomplishing this? I've been reading through the CA documentation, but it's been hard for me to pinpoint which parts are relevant to what I want to do since I have no experience with the framework.

Any tips at all would be much appreciated.

Thanks.

解决方案

Since you're talking of a NSView, you're probably using Cocoa's animation support, not CA directly. In this case, you just need to set the view's frame through the view's animator object:

[theView setFrame:offscreenFrame];
[[theView animator] setFrame:finalFrame];

Unfortunately, Cocoa view animation interacts badly with the more advanced features of CA, like setting an easing. You might have more luck using NSViewAnimation instead, which is not Core Animation-backed and allows for a little more flexibility.

这篇关于核心动画 - 片状窗口滑动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆