CALayer is almost certainly what you want, and a good book on Core Animation will do you wonders.
On 29 Jan 2010, at 11:05, Roland King wrote: > I'm failing to understand I think exactly what CALayer gives me and thus > whether or not it's good for something I'm working on. I've read the > documentation pretty thoroughly I think but I'm not getting it. > > Target here is IPhone OS, which may matter. Concept is a view with a number > of 'objects' drawn on it, 5, 15, 15, 20 .. that's about it. They can move > around, they can have some kind of z-ordering amongst themselves. The objects > need to draw themselves instead of having one big drawRect: statement. > > One way to do it would be to have one UIView which asks each object "are you > in this rectangle" and if so "please draw nicely" at the correct place on the > UIView's layer. I was a bit bothered however what would happen if I move an > object from one point to another, at the least I'd have to invalidate the > entire rectangle from the corner the thing started, to where it ended up to > make sure everything it passed over gets redrawn and perhaps even that's not > enough. > > So I read about CALayers and was trying to understand whether I get something > for free over and above the method just described. Do CALayers retain their > content so that as they are moved they don't redraw themselves but are just > recomposited in a different area of the screen? That would of course be a win > as the first method means redrawing the object in different locations on the > UIView's layer, recomposition means I drew it once and that's it. How about > other layers, if the content is retained, then I wouldn't have to redraw > those either, the entire movement just becomes a compositing exercise by the > GPU. > > If CALayers don't retain content (or perhaps only a limited number of them > can if there's a GPU limitation) then there would still be redrawing calls > but, it seems, I wouldn't have to worry about figuring out what layers need > redraws (ie figuring out the big dirty rectangle), something else would be > working that out and just telling the affected CALayers to redraw. > > Am I understanding CALayer at all or am I totally out in the woods here and > have misunderstood the concepts? Is there a piece of documentation which > explains these points which I either missed, or failed to understand > properly. > > Thanks. _______________________________________________ > > Cocoa-dev mailing list ([email protected]) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net > > This email sent to [email protected] _______________________________________________ Cocoa-dev mailing list ([email protected]) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
