0
我使用CABasicAnimation
來動畫NSView
的旋轉。代碼在iPhone上運行良好,現在我想將它植入可可。使用CABasicAnimation的NSView旋轉動畫運行不正確
[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"];
當它運行時,該視圖的框架似乎被覆蓋,如下圖所示:
你可以看到四個頂點不顯示。
因爲我對可可不太熟悉,誰能告訴我問題在哪裏?
謝謝!