我使用CABasicAnimation
为 a 的旋转设置动画NSView
。该代码在 iPhone 上运行良好,现在我想将它种植到可可中。
[self.secondView setWantsLayer:YES];
CABasicAnimation *anim2 = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
anim2.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
anim2.fromValue = [NSNumber numberWithFloat:0];
anim2.toValue = [NSNumber numberWithFloat:-((360*M_PI)/180)];
anim2.repeatCount = HUGE_VALF;
anim2.duration = 8.0;
[self.secondView.layer addAnimation:anim2 forKey:@"transform"];
当它运行时,视图的框架似乎被覆盖了,如下所示:
您可以看到四个顶点未显示。
由于我对可可不太熟悉,谁能告诉我问题出在哪里?
谢谢!