tajmahal
tajmahal

Reputation: 1675

Animate opening a new window with NSWindowController

Starting with Mac OS X 10.7, new NSDocument windows as well as alert windows open with an animation. Windows opened with NSWindowController's showWindow: method, however, get no animation.

Is there a way for these windows to get the same animation?

Upvotes: 4

Views: 1820

Answers (1)

IluTov
IluTov

Reputation: 6852

You can define how a window opens.

In the Interface Inspector under Animation you can choose Document Window Style, and you should get the same behaviour.

Or in code:

[self.window setAnimationBehavior:NSWindowAnimationBehaviorDocumentWindow];

Here all the behaviours you can use

enum {
    NSWindowAnimationBehaviorDefault = 0,       // let AppKit infer animation behavior for this window
    NSWindowAnimationBehaviorNone = 2,          // suppress inferred animations (don't animate)

    NSWindowAnimationBehaviorDocumentWindow = 3,
    NSWindowAnimationBehaviorUtilityWindow = 4,
    NSWindowAnimationBehaviorAlertPanel = 5
};

Upvotes: 11

Related Questions