Search code examples
bitmapuikitcore-animationuigesturerecognizerappkit

Should I use CoreAnimation to move a complex view around quickly during user gestures?


I have an OSX app where the user interacts with a view via pan, scale and rotate gestures. I handle this by manipulating the view transform which works fine.

However under some circumstances the time taken to redraw the view can make the interaction a bit less than smooth. Therefore during the course of a gesture (e.g. a UIRotationGesture) I would like to make a speed/quality tradeoff.

In particular, during the course of the gesture I would like to display to the user a rotated and scaled bitmap version of the content, which I can then replace with the properly redrawn content once the gesture is complete.

I've started to do some experimentation with CoreAnimation and it seems promising, but before I go too far down the line it would help to know if a CALayer is a good foundation to build on to achieve what I'm trying to do. I guess I really only need the ability to capture content into a bitmap and then to display it in a rotated and scaled form - I don't really need 'animation' features like frame-by-frame interpolation between a start and end state.


Solution

  • OK so after a few days I managed to achieve what I set out to do - and I can confirm that YES, CoreAnimation was a good way to approach it.

    It was an interesting journey and I learned a lot of useful stuff along the way.