views:

450

answers:

2

I have two CALayer subclasses, each with their own drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx delegate. They are both simple layers (some single color shapes drawn with CG paths), but I need to scale about 12 instances simultaneously, and I'm having some issues with frame rates. I marked all of the layers as opaque to try to free up some cycles, and have tried using implicit and explicit basic animations (on the bounds property itself), as well as assigning CA3DTransform matricies to the transform property.

Does anyone know of a good way to quickly resize objects while maintaining a good frame-rate?

+1  A: 

This doesn't sound to be beyond the capabilities of the iPhone.

One solution might be to render them to an image and scale that? This is (more or less) what CoreAnimation would do. It sounds like you have a defect though - maybe you should post your code and people could look at it.

Where are you performing the redraw and what are you redrawing?

Roger Nolan
A: 

I agree with Roger.

Check how often your drawLayer:inContext: methods (or whatever you use to draw) are being called. A simple NSLog can accomplish that. If they are being called constantly, consider Roger's idea of rendering to an image and scaling that.

You will likely have to fire up the performance tools to find your bottleneck.

Kailoa Kadano