On Jun 18, 2009, at 6:39 PM, David Duncan wrote:

On Jun 17, 2009, at 10:45 PM, WT wrote:

If the center is in the superview's coordinate system, how can it not be changed by a translation?

Because the center is only 1 part in the chorus of things that determines where your view is. All of this really translates to Core Animation under the covers, and what UIKit reports to you as the center of a view is the view's layer's position. So lets go strictly to layers for a moment.

A layer has 4 properties that affect its area on screen – position, bounds.size, anchorPoint and transform. All of these properties together produce the final bounding rect in 3D space for the layer, which is then flattened into the frame rect that we all know and love.

So the position property of the layer never changes when you transform a layer, regardless of the transform. The layer moves when you apply a translation transform to it because you've changed the bounding rect that was calculated from the transform along with the other 3 properties I mentioned.

In the view's own coordinate system, yes, I can see that that's true, because then the center is half-way the bounds' width and height, and those don't change under a translation.


The view's center property is the point around which the view bounds are located. If you change the view's layer's anchorPoint, then the view's center will have a different meaning. It defaults to half way between, but really its saying to place half of the bounds on either side of the position.
--
David Duncan
Apple DTS Animation and Printing

Hi David,

I very much appreciate that you spent the time to explain all that (and not just for my benefit, but for everyone else's as well), but I'm still very confused by what you said, even more so now.

Ultimately, I have some rectangular area on the 2D screen of an iPhone or a Mac, and it has a center point (which, I understand, doesn't *have* to be halfway through the bounds), whose coordinates are measured in the coordinate system of the rectangle's superview. I then apply a translation to this rectangle and it ends up somewhere else on that screen. Assuming that the rectangle's superview was not translated along as well, I cannot see how the coordinates of the rectangle's center would not have changed.

Now, I fully realize that my lack of understanding is entirely due to not having worked with layers, meaning that I have not spent any serious time reading the docs on them (meaning that I should!).

I would love to continue this discussion off-list but, realistically, I am not prepared enough for that yet, so I won't impose on you any more than I already have. I am soon going to dive into core animation for an app I'm working on and maybe then I'll understand what you wrote above. And, if not, at least I'll be ready to ask more specific questions.

Regardless, thank you for trying to make sense of it for me (and others).

Wagner_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com

Reply via email to