Positioning of a running animation on orientation change

I have applied a CABasicAnimation to a layer. The animation modifies the "position.y" layer property to create a gentle bouncing effect; it is set to autoreverse and repeat.

I use the From and To values to position the animation in the bottom right quadrant of the screen. It works quite nicely until I change the orientation of the device. The problem is the animation is positioned relative to the top of the screen. So when the orientation changes it is no longer positioned in the correct place.

The autoresizingMask for the View itself is correctly set in interface builder, but the animation doesn't seem to take any notice of that. I guess because the animation is assigning an absolute value to the layers position.

I'm a bit stumped, thanks in advance.


你可以把你的动画放在一个独立的视图中,这样它就是独立的,然后通过旋转来调整视图?

链接地址: http://www.djcxy.com/p/12878.html

上一篇: 左右旋转一层使用两个不同的UIButtons

下一篇: 在定位更改上定位正在运行的动画