我想要一個按鈕移動到一個座標,暫停,移動到另一個協調,暫停,然後再次移動。該過程應該無限重複。我現在所擁有的只是最後一步。動畫按鈕延遲 - iPhone
這是我迄今爲止(「發」是的UIButton名):
- (void) firstAnimation {
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
[UIView setAnimationDelay:5];
[UIView setAnimationRepeatCount:-1];
[UIView setAnimationRepeatAutoreverses:NO];
CGPoint pos = mover.center;
pos.y = 200.f;
pos.x = 169.f;
mover.center = pos;
[NSTimer timerWithTimeInterval:1.0 target:self selector:@selector(firstAnimation:) userInfo:nil repeats:NO];
pos.y = 100.f;
pos.x = 179.f;
mover.center = pos;
[NSTimer timerWithTimeInterval:1.0 target:self selector:@selector(firstAnimation:) userInfo:nil repeats:NO];
pos.y = 160.f;
pos.x = 129.f;
mover.center = pos;
[UIView commitAnimations];
}
感謝您的幫助
感謝您的留言。我使用以下內容淡入淡出圖像。我將如何讓它重複無限? - (無效)firstAnimation { \t \t [UIView的animateWithDuration:2.0 \t \t \t \t \t \t \t \t \t \t動畫:^ { \t \t \t \t \t \t \t \t \t \t \t \t tapImage.alpha = 0.0 ; \t \t \t \t \t \t \t \t \t \t \t \t tapImage.alpha = 1.0; \t \t \t \t \t \t \t \t \t \t \t} \t \t 完成:^(BOOL完成){ \t \t \t \t \t \t \t \t \t \t \t \t [自secondAnimation]; }]; } – hanumanDev 2010-10-13 22:35:20