NSPopover custom animation

1.7k views Asked by At

Is there any way to create a custom animation for NSPopover?

I can switch off the animation by using the animates property, however since NSPopover is a subclass of NSResponder and not a proper view or window I can't figure out how to animate it myself.

3

There are 3 answers

0
Rob Keniger On BEST ANSWER

There is no way to hook into the animation system of NSPopover. I did a class-dump of the interface and it doesn't even look like there are any useful private methods.

If you want a custom animated popover you will need to implement it from scratch (which is not that hard, really).

0
Elbimio On

The popover will animate depending on the view it is displaying. By just resizing the view in a particular way will make the popover animate while it's resizing the view. Of course, this will only work if the animation you want is fairly simple and can be implemented to the popover's view.

0
Jinwoo Kim On

NSPopover has a private property named _popoverWindow, type of _NSPopoverWindow.

_NSPopoverWindow has setAnimates: method. You can disable default animation using this method, and make a custom animation of _popoverWindow using NSPopoverDelegate.