Re: Core Animation. issue with scaling
Re: Core Animation. issue with scaling
- Subject: Re: Core Animation. issue with scaling
- From: Eric Wing <email@hidden>
- Date: Sat, 21 Aug 2010 15:02:17 -0700
On 8/21/10, Ahsan Shafiq <email@hidden> wrote:
> Yes, you are right but now I am unable to handle touches.
> As I said in my previous post, I also want to update the model. Simply
> scaling as you mentioned does scale down or scale up the sublayers as well
> but how to update the model. In Scaling both the position and bounds get
> changed!! and after animation I just can not get the updated position and
> bounds of a layer and also of it's sublayers.
I'm not sure how you are detecting touches now, but you should look at
using CALayer's hitTest: method to determine if/what layer was
clicked/touched. If the animation is still moving, you definitely need
to be querying the presentationLayer and not the modelLayer.
hitTest should account for a layer that has been transformed by a
matrix. Another example of needing hitTest is if your layer is rotated
in 3D. Other Cocoa hit mechanisms won't be able to detect that
'skewed' hit area.
Otherwise, your alternative is to manually change the bounds and
positions for each and every one of your layers. As I said, changing
the bounds of a parent layer will not change the bounds of a child
layer. Bounds is not a scale property. They are subtly different
things.
-Eric
--
Beginning iPhone Games Development
http://playcontrol.net/iphonegamebook/
_______________________________________________
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