2009-01-01 98 views
5

使用iPhone CALayer,我想爲我的精神層提供一個旋轉動畫,但是我也想要爲動畫結束回調,這麼做很熱嗎?CALayer動畫結束回調?

我想也許我應該使用CABasicAnimation,但我不知道如何做旋轉使用CABasicAnimation,任何想法?

感謝

回答

3

順便說一句,你還可以通過包裝您的來電旋轉做同樣的一個UIView動畫回調在的代碼

[UIView beginAnimations:nil context:NULL]; 
[UIView setAnimationDuration:0.5f]; 
[UIView setAnimationDelegate:self]; 
[UIView setAnimationDidStopSelector:@selector(rotationAnimationHasFinished:finished:context:)]; 
// Rotate the view here 
[UIView commitAnimations]; 

以下塊,然後限定了委託方法

- (void)rotationAnimationHasFinished:(NSString *)animationID finished:(BOOL)finished context:(void *)context; 
{ 
// Handle the completion of the animation 
} 

一個UIView在您的委託中,您可以在動畫完成後執行您所需的任何操作。