0
我有一個應用程序,當按下按鈕(圖像)時會旋轉兩次。我想循環縮放按鈕並搖動按鈕。所以這三個動畫將是:縮放,平移,旋轉。我怎樣才能隨機循環?這是我目前擁有的按鈕:通過按鈕上的動畫隨機循環
- (IBAction)playAudioAction:(id)sender {
UIButton *btn=(UIButton *)sender;
CABasicAnimation *fullRotation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
fullRotation.fromValue = [NSNumber numberWithFloat:0];
fullRotation.toValue = [NSNumber numberWithFloat:((360*M_PI)/180)];
fullRotation.duration = 0.5;
fullRotation.repeatCount = 2;
[btn.layer addAnimation:fullRotation forKey:@"360"];
[self playAudioOfType:btn.tag];
}