views:

233

answers:

1

The documentation says:

The presentation tree contains the values that are currently being presented to the user as an animation takes place. For example, setting a new value for the backgroundColor of a layer immediately changes the value in the layer tree. However, the backgroundColor value in the corresponding layer in the presentation tree will be updated with the interpolated colors as they are displayed to the user.

Now the truth from my hard-core 8-hours-testing in a sandbox with only one view and an animation. During the animation I ask for:

CATransform3D currentTransform = [(CALayer*)[self.layer presentationLayer] transform]

I check for m11 and m12 values of currentTransform, to calculate the current rotation angle.

When I set up to rotate 90 degrees, two things happen, while animation takes place and has not finished:

  • sometimes my calculated angle based on the currentTransform is 0.0, although the view is rotated by some angle and definitely not at 0.0.

  • and sometimes (most often) it's just exactly the target value of 90 degrees.

But I never get what I want: The current state in the animation. I've been searching a while on the net, and developers seem to make rarely use of this. So that's either an bug in the framework or a bug in the documentation, or my code above to obtain the current visible transform is totally wrong.

A: 

I know I have pulled the frame from the presentation layer to find the location of a view on screen during animation. That definitely works.

I used it to stop the animation then update the current the view with the presentation layer frame.

It should work, I think you will need to post your specific code to figure this out.

Corey Floyd