Re: Rotated CALayer and issues with coordinates (should I convert them manually?)
Re: Rotated CALayer and issues with coordinates (should I convert them manually?)
- Subject: Re: Rotated CALayer and issues with coordinates (should I convert them manually?)
- From: Daniele Margutti <email@hidden>
- Date: Mon, 29 Apr 2013 10:18:16 +0200
On Apr 29, 2013, at 9:33 AM, David Duncan <email@hidden> wrote:
> On Apr 27, 2013, at 2:48 AM, Daniele Margutti <email@hidden> wrote:
>
>> If I try to rotate my hostView.layer (CALayer) using the function below I get wrong coordinates when I try to click at the same (rotated) point (the top,left coordinate of hostView)
>
> Point conversion happens via the model layer, not the presentation layer. By rotating the layer the way you've done, you've only changed the presentation layer, rather than the model, and thus the hit testing fails.
>
> Instead just set the layer's transform. If you want to customize the duration then use the +[CATransaction setAnimationDuration:]. No need to get into explicit animation and the many pitfalls that typically accompany it.
Hi David, thank you for your response;
I've also tried to use:
[CATransaction begin];
[CATransaction setAnimationDuration:4.0];
hostViewLayer.affineTransform = CGAffineTransformMakeRotation(DEGREES_TO_RADIANS(-90));
[CATransaction commit];
and using:
hostViewLayer.transform = CATransform3DMakeRotation(DEGREES_TO_RADIANS(-90),0,0,1);
(while animation is not played) coordinates still at the old position (portrait) of the layer.
What am I wong?
_______________________________________________
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