Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 600
tajmahal Avatar asked Oct 25 '25 20:10

tajmahal


1 Answers

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
};
like image 67
IluTov Avatar answered Oct 27 '25 19:10

IluTov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!