【发布时间】:2016-01-13 10:09:57
【问题描述】:
我正在使用 CABasicanimation 来旋转 UIView。我正在使用此代码,
CABasicAnimation *rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
NSNumber *currentAngle = [CircleView.layer.presentationLayer valueForKeyPath:@"transform.rotation"];
rotationAnimation.fromValue = currentAngle;
rotationAnimation.toValue = @(50*M_PI);
rotationAnimation.duration = 50.0f; // this might be too fast
rotationAnimation.repeatCount = HUGE_VALF; // HUGE_VALF is defined in math.h so import it
[CircleView.layer addAnimation:rotationAnimation forKey:@"rotationAnimationleft"];
在这个我想要完美的 X、Y 位置,而“UIView”正在旋转。 如果有人知道,请帮助我。
【问题讨论】:
-
您能否再解释一下您所说的完美 x 和 y 位置是什么意思以及您的视图必须以哪种方式旋转?您是否希望它在 Z 轴上旋转(所以在 3D 空间中?)。
-
实际上,我在两侧旋转我的 UIView 并在点击事件中旋转,当这个 UIView 旋转时,我想要一个 UIView 的完美位置,它实际上在哪个位置。
-
我想要一个 (X,Y) 的位置
-
不 它不像 3d 不在 z 中。我只是在 UIView 的同一位置上旋转 UIVew。
标签: ios rotation position cabasicanimation