• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: should I use CALayer .. ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: should I use CALayer .. ?


  • Subject: Re: should I use CALayer .. ?
  • From: Matt Neuburg <email@hidden>
  • Date: Fri, 29 Jan 2010 09:58:22 -0800
  • Thread-topic: should I use CALayer .. ?

On Fri, 29 Jan 2010 19:05:01 +0800, Roland King <email@hidden> said:
>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?

Yes, more or less exactly.

I like to think of a layer as a very powerful pane of glass in front of a
view. The view's drawing is actually expressed in the layer, or to put it
another way, the layer contains the bitmap for the view. So now you can do
all kinds of powerful things with that bitmap: move it around, rotate it in
3d space, resize it, and transform it in lots of other cool way, with
animation thrown in. Moreover, you can just abandon drawing in the view and
do all the work directly in the layer - and layers can contain sublayers
(even when there is no corresponding subview).

I think your first move should be to look at the GeekGameBoard example.
Yeah, it's Mac OS rather than iPhone, but when you see what it can do, how
it uses the fact that layer instances are objects to encapsulate the desired
behavior, you'll see instantly how cool and powerful layers are.

The only "problem" with layers when you first start using them is they live
entirely in the CoreGraphics world, so you have to learn a new vocabulary
for working with them. It's a different kind of image, a different kind of
Bezier path, a different kind of color, from what you're used to. But you'd
be surprised how quickly you get past that.

m.

--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.tidbits.com/matt/default.html#applescriptthings



_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

  • Prev by Date: Re: Detect HFS path type and coerce to POSIX
  • Next by Date: Re: Hot to define a connection from source code?
  • Previous by thread: Re: should I use CALayer .. ?
  • Next by thread: FSEventStreamCreate and File System Events Wierdness
  • Index(es):
    • Date
    • Thread