I would like to disable the animation that Cocoa performs when displaying a modal sheet.
Apple's Sheet Programming Guide states:
... Other sheet behavior, such as the animation when it appears and is dismissed, is handled automatically by the Application Kit.
But it doesn't provide any hints on how to disable this effect.
I have created a custom sheet (a subclass of NSWindow with a transparent background and some controls in it). I am able to display it using the standard beginSheet method as follows:
[NSApp beginSheet:myCustomSheet
modalForWindow:mainWindow
modalDelegate:self
didEndSelector:...];
The sheet displays fine, but it goes through an animation when it appears, and again when it closes.
Note: I am writing a completely customized user interface for a touch screen / kiosk type app, so none of the usual Apple user interface guidelines apply.
This is a wild guess (I'm too lazy to try it) but the animation might be handled using Core Animation. If so, you might be able to do this:
Override
animationResizeTime:
in the NSWindow you're presenting as a sheet and have it return 0. This is better than messing with CATransaction (which doesn't seem to work reliably) or NSWindowResizeTime (which affects all windows).There is a user default for the animation speed of sheets. Look it up and see what happens if you try to set it to 0.