ボタンを座標に移動し、一時停止し、別の座標に移動し、一時停止してから、もう一度移動しようとしています。その後、プロセスは無限に繰り返されます。私が今持っているものは、最後のステップを動かすだけです。
これは私がこれまでに持っているものです(「mover」は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];
}
助けてくれてありがとう