1
我試圖轉動它在左上角用行動一個UIButton一個UIView:旋轉的UIView與按鈕它
[email protected]"hello";
現在我旋轉的UIView 180°和按鈕現在在右下角。但是隻有當我按下左上角時按鈕纔會觸發它的動作...所以它像按鈕的位置已經改變,但它的動作停留在旋轉之前的相同位置?
我使用CAKeyframeAnimation
旋轉視圖。
CAKeyframeAnimation *rotationAnimation;
rotationAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform.rotation.z"];
rotationAnimation.values = [NSArray arrayWithObjects:
[NSNumber numberWithFloat:0.0 * M_PI],
[NSNumber numberWithFloat:0.75 * M_PI],
[NSNumber numberWithFloat:1.5 * M_PI],
[NSNumber numberWithFloat:2.0 * M_PI], nil];
rotationAnimation.calculationMode = kCAAnimationPaced;
rotationAnimation.removedOnCompletion = NO;
rotationAnimation.fillMode = kCAFillModeForwards;
rotationAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
rotationAnimation.duration = 10.0;
CALayer *layer = [rotateView layer];
[layer addAnimation:rotationAnimation forKey:@"rotationAnimation"];
把你的旋轉動畫代碼的細節 –