1
votes

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.

1
As I responded in the comments on my answer to your original question: stackoverflow.com/questions/877198/… , I used the exact code posted there to poll the rotation during the animation, and it gave the correct mid-animation value every time. You're doing something differently in your implementation that is causing you to get incorrect values. Perhaps you could provide more detail in your question, or a link to your test application.Brad Larson

1 Answers

1
votes

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.