Re: More CALayer Questions
Re: More CALayer Questions
- Subject: Re: More CALayer Questions
- From: Jens Alfke <email@hidden>
- Date: Mon, 7 Jul 2008 14:31:12 -0700
On 7 Jul '08, at 12:42 PM, Gordon Apple wrote:
One source of confusion is the anchorPoint/Position relation.
Reference
says "The position is relative to anchorPoint". Huh? What
anchorPoint? --
the layer in question, or its superLayer? And what does this mean
for the
view's layer in terms of the view's coordinates?
When you set the position property of a layer, the point you specify
becomes the location (in the superlayer's coords) of the layer's
anchorPoint. The anchorPoint is specified in unit coordinates that
range from 0 at one side to 1 at the other, so it's independent of
scale.
So if the layer's anchorPoint is (0.5,0.5), as it is by default, then
if you set its position to (100,100), the center point of the layer
will be at (100,100).
But if the anchorPoint were (0,0), then the top left point of the
layer would be at (100,100) ... assuming non-flipped coords.
Another one is "frame". "Specifies receiver’s frame rectangle in
the
super-layer’s coordinate space". So ok, how does the view's layer
frame
relate to the view's frame?
I am not sure; I don't work with layers directly embedded in views
much. (I usually just have one big view and work with layers inside
it.) My expectation would be that the layer's frame would be the same
as the view's bounds.
—Jens_______________________________________________
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