Reputation: 5389
I'm trying to figure out how best to accomplish drawing a scene in an iphone app. Here is the situation:
I'm not really sure where to start - but because things aren't animated too much it doesn't seem like this has to be really performant so I'm thinking Quartz will be the way to go.
Some possible solutions I can think of:
Use quartz: Draw the background to a view's cgcontext. Create several CGLayers and draw the text/images to them. Transform the CGlayers (can you do this?) then draw the layers to the main CGContext.
use OpenGL: please no. unless I really need to.
Ideas?
Thanks.
Upvotes: 1
Views: 1220
Reputation: 10065
Mostly agree with Marco. CA is perfect for this work. Set up a view and add a bunch of layers.
A couple of points though.
You can directly draw text using the NSString UIStringDrawing category methods. works really well and don't have the overhead of UILabel.
Drawing with CoreGraphics is not too slow, because CoreAnimation intelligently caches the layer. That is, it's only drawn once and then CA animates a copy unless the layer is sent a setNeedsDisplay
message.
Upvotes: 1
Reputation: 3859
Use CoreAnimation CALayers
for the imags (you can apply tranformations to them) and UILabels
for the text. Drawing with CoreGraphics will be too slow for animating.
Upvotes: 1