Re: Group CGAffineTransform Animations?
Re: Group CGAffineTransform Animations?
- Subject: Re: Group CGAffineTransform Animations?
- From: WT <email@hidden>
- Date: Thu, 18 Jun 2009 21:15:22 +0200
On Jun 18, 2009, at 8:19 PM, David Duncan wrote:
On Jun 18, 2009, at 11:01 AM, WT wrote:
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.
Your confusing the geometric center of the view's rectangle with the
center property of the view. Specifically in code if you do this:
CGPoint c = view.center;
view.transform = CGAffineTransformMakeTranslation(20, 20);
CGPoint visualCenter = CGPointMake(CGRectGetMidX(view.frame),
CGRectGetMidY(view.frame));
CGPoint c2 = view.center;
Then you will find that c == c2, c != visualCenter, and c2 !=
visualCenter.
This is why using translations for transforms is very confusing. You
expect the center of the view to change, but it does not. This is by
design.
Ok, simple enough. But, then, IMHO, "center" is a terrible name for
the view.center property.
Wagner
_______________________________________________
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