Basically, what I'm trying to do is revitalize the cloud, and then change its speed and / or direction of the average animation if the wind changes. If that matters, I control it all from the UIViewController, and the cloud exists UIView with CALayer on top of this, which is the cloud. I also tried this with a UIImageView on top.
For TL: DR types, in short, what I'm trying to do is either get the position of the animated view, or stop the animated view using block animations.
And here is the full story. My problem is to get my position during the animation. I use block animation. Because I only know the speed with which he must move, I need to calculate the time myself, using the distance on the left. I tried the following code and several variations of it:
[[Cloud CloudImage]convertPoint:CGPointMake([[[Cloud CloudImage] presentationLayer] position].x, 0) toLayer:self.layer].x
Where Cloud is UIView and CloudImage is CALayer. This was the most difficult variation I tried, I tried a few simpler ones (with a direct request to the Cloud, for example, or with a UIView instead of CALayer). However, all that it returns is its final value. I read something about this method, which has been broken since 3.2, but fixed in 4.2; However, this was not fixed when I changed the deployment target to iOS 4.3 instead of 4.0. I am using basic sdk 4.3.
Several other options that I considered stopped the animation for a while, and then immediately took a position and started a new animation. However, I will need to know how to stop the block-based animation, and I only found fragments of the old animation system (commitanimations).
The last one I reviewed was writing my own animation system; The cloud will have a repeating NSTimer after 0.08 seconds or so, and create a kernel animation of 0.08 seconds each time it starts, for which it uses the speed given to the cloud as a property. However, I am afraid that any version of this will have much lower performance, while I need it to be as light as possible, since I have up to 20 of these clouds at the same time (and sometimes with rain) .
Thanks in advance!