Draw CoreGraphics offscreen to prevent animation stuttering during transitions?

Go To StackoverFlow.com

0

I have a number of situations in my application where I am transitioning from one view to another with a CATransition. On view being transitioned to, there is often a graphic drawn by CoreGraphics. For argument's sake let's say it's a couple of squares. However when animating into the view, the animation stutters for a split second midway through the transition as it draws the graphic for the first time.

Is there a (hopefully simple) way of pre-drawing this view with its custom graphics prior to the animation beginning, so this stutter doesnt occur?

2012-04-05 02:10
by Dermot
I have managed to reduce stutter in my animations (which is an opacity change) by setting the initial value on the layer, and as early as possible, before playing the animation - Henrik 2015-07-18 19:54


0

Set shouldRasterize to YES on the layer.

2012-04-05 09:01
by Benjamin Mayo
I already have this set, but I still get a stutter when it slides in. I've even manually rasterized the layer by capturing the drawing to a bitmap, and displaying the bitmap where the drawing is, then swapping out the image for the drawing once the animation is complete, but there is still a stutter. This is not really the answer I was looking for, but may help some people, so I am marking it as the answer unless anyone comes up with a better solution - Dermot 2012-04-09 07:20
What CATransition are you using - Benjamin Mayo 2012-04-09 07:56
CATransitionPush and the sub type is TransitionFromTop. Note that in another instance Im adding the new view to the current view's PARENT view, at the position 0,480,320,480 (off the bottom of the screen), then using UIKit animation to animate the current view to 0,-480,320,480 and the new view to 0,0,480,320, then removing the old view from the subview array. Still get a little stutter thoug - Dermot 2012-04-10 10:45
Ads