全屏狮子复合动画

发布于 2024-11-29 04:51:25 字数 628 浏览 0 评论 0原文

我正在将窗口转换为全屏模式(新的 Lion 类型的全屏模式)。当我进行转换时,我还想将 NSWindow 中的视图之一滑动到新位置。

因此,在我的 NSWindowDelegate 中,我尝试返回窗口并实现自定义动画:

- (NSArray *)customWindowsToEnterFullScreenForWindow:(NSWindow *)window
{
    return [NSArray arrayWithObject: window];
}


- (void)window:(NSWindow *)_window startCustomAnimationToEnterFullScreenWithDuration:(NSTimeInterval)duration
{
    // book is NSView *ivar
    [[book animator] setFrame: NSMakeRect(/*computed rect*/)];

}

但这完全杀死了进入全屏模式的默认动画,并且我的窗口突然无法正确绘制。

有没有办法在仍然使用默认动画的同时复合这些?我对[view animator]级别的核心动画还很陌生,所以我确信我搞砸了一些非常简单的事情。

I'm transitioning a window to full screen mode (the new Lion kind of full screen mode). While I do the transition, I'd like to also slide one of the views in my NSWindow to a new position.

So, in my NSWindowDelegate, I've tried returning the window and implementing the custom animation:

- (NSArray *)customWindowsToEnterFullScreenForWindow:(NSWindow *)window
{
    return [NSArray arrayWithObject: window];
}


- (void)window:(NSWindow *)_window startCustomAnimationToEnterFullScreenWithDuration:(NSTimeInterval)duration
{
    // book is NSView *ivar
    [[book animator] setFrame: NSMakeRect(/*computed rect*/)];

}

But this completely kills the default animation of going to full-screen mode and my window suddenly doesn't paint correctly.

Is there some way to compound these while still using the default animation? I'm pretty new to core animation beyond [view animator] level stuff, So I'm sure I'm screwing up something quite simple.

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

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

发布评论

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

评论(1

守望孤独 2024-12-06 04:51:25

你必须写这样的东西才能使两个动画同步:

- (void)window:(NSWindow *)_window startCustomAnimationToEnterFullScreenWithDuration:(NSTimeInterval)duration
{
    // book is NSView *ivar
    [[NSAnimationContext currentContext] setDuration:duration];
    [[book animator] setFrame: NSMakeRect(/*computed rect*/)];

}

You have to write something like this in order to have the two animations in sync:

- (void)window:(NSWindow *)_window startCustomAnimationToEnterFullScreenWithDuration:(NSTimeInterval)duration
{
    // book is NSView *ivar
    [[NSAnimationContext currentContext] setDuration:duration];
    [[book animator] setFrame: NSMakeRect(/*computed rect*/)];

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