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: Mon, 23 Aug 2010 00:39:30 -0700
>> 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.
>>
>>
> I am detecting touches in UIView/ UIViewController as only these two are
> inherited from UIResponder. I am able to detect touches but after applying
> core animation on layers the touches do not move, they stay where they were
> before the animation, so if i click new position of layer nothing happens.
> "IF" I do not explicitly change the properties of layer position (as given
> in the code i quoted, forget the bounds code i have written) etc...
So you would probably want to override the touch events in your
UIView, and pass the touch location to the view's CALayer hitTest
method to see if you get a hit in any of the contained layers.
>> 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.
>>
> Hi, can you please elaborate a bit, you said otherwise (means with out
> hittest?). Yes I am clear on bounds issue.
There's no magic here. I'm just saying instead of scaling the parent
layer, you traverse through all your views/layers and manually set the
bounds (and position) of each one individually. So if you want to
"scale" everything by 50%, you traverse through every view/layer in
your app and change each individual bounds property so each width and
height are half of what they were before. (You may also need to adjust
the positions if your positions are relative to one another.) Assuming
everything is a UIView and not a CALayer, this technique really has
nothing to do with Core Animation. I'm sure you already thought of
doing this. It's tedious and not much fun, but it may get the job done
in your case.
-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