CAShapeLayer slowing down interface rotation
- by MrMage
Hi,
I am trying to move some custom drawing code from a view into a CAShapeLayer, which then get added as a sublayer to the original view's CALayer. This also works well, but when rotating the device, the animation starts to stutter, e.g. you just see the frame in the original orientation and then the final orientation, with at most one frame in between - not smooth at all. Slide-in and slide-out animations of the corresponding UIViewController are a bit jerky, too (but not that much).
All the CAShapeLayer has in its path is one CGPathAddRect, it is set to be opaque, its opacity is 1.0f and the fillColor is set to opaque blue.
When drawing the path directly in the views drawRect method, however, the animation is smooth. So I suppose it has something to do with the CAShapeLayer being animated during the rotation.
Could you tell me how to either get rid of those jerkiness or just hide the CAShapeLayer when animating? Getting back to just draw CGPaths directly is not an option to me because I rely on the ability of CAShapeLayer to animate its path (it is not animated in my tries with rotating the view).
/update: this also happens when the rotating UIViewControllers view contains a view with a subclass of CAGradientLayer as its layerClass (e.g. a view with a gradient layer as background).
Cheers
MrMage