1
votes

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.

1
I'm not sure that Lion actually animates the window. I think it may just take a picture, then fade and expand to the new window size. Look carefully at the animation. - spudwaffle

1 Answers

1
votes

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*/)];

}