How to customize the segue animation to show an NSWindowController?

392 Views Asked by At

I am attempting to create a preferences window using a storyboard, as was briefly demonstrated in WWDC 2014 Session 212 - Storyboards and Controllers on OS X. I have a "Preferences…" menu item that should show the preferences window when clicked. In Interface Builder, I connected the action segue for the preferences menu item to the preferences window controller. When I select the "Modal" style for the storyboard segue, then the preferences window is shown when the preferences menu item is clicked, but it is animated into view.

I would like the preferences window to be shown without any animation, like what happens when you open Xcode > Preferences or Safari > Preferences.

I have tried creating a custom NSStoryboardSegue and overriding the perform method in two different ways:

  1. Call the showWindow: method of the destinationController (the NSWindowController).

    This does not show the preferences window.
    Actually, the window briefly flashes on screen behind all of the other windows, and then disappears.

  2. Call the makeKeyAndOrderFront: method on the storyboard segue's window.

    The window starts to appear, but disappears soon after. It seems that the window is being animated into view, but the window is abruptly hidden at the end of the animation.

How do I customize the segue to show the window without animating?

0

There are 0 best solutions below