Search code examples
cocoacore-animation

How can I trigger Core Animation on an animator proxy during a call to resizeSubviewsWithOldSize?


I have some NSViews that I'm putting in one of two layouts depending on the size of my window.

I'm adjusting the layout when the relevant superview receives the resizeSubviewsWithOldSize method.

This works, but I'd like to animate the change. So naturally I tried calling the animator proxy when I set the new frames, but the animation won't run while the user is still dragging. If I release the mouse before the animation is scheduled to be done I can see the tail end of the animation, but nothing until then. I tried making sure kCATransactionDisableActions was set to NO, but that didn't help.

Is it possible to start a new animation and actually have it run during the resize?


Solution

  • I don't think you can do this easily because CA's animations are run via a timer and the timer won't fire during the runloop modes that are active while the user is dragging.

    If you can control the runloop as the user is dragging, play around with the runloop modes. That'll make it work. I don't think you can change it on the CA side.