4 つの UIbuttons があり、それらの x 原点を変更する必要があります。今ではこの方法を使用しています:
[UIView animateWithDuration:1.0
delay:1.0
options: UIViewAnimationCurveEaseInOut
animations:^{
self.Button1.frame = CGRectMake(-120, self.Button1.frame.origin.y, self.Button1.frame.size.width, self.Button1.frame.size.height);
}
completion:^(BOOL finished){
[UIView animateWithDuration:1.0
delay:1.0
options: UIViewAnimationCurveEaseInOut
animations:^{
self.Button1.frame = CGRectMake(-140, self.Button1.frame.origin.y, self.Button1.frame.size.width, self.Button2.frame.size.height);
}
completion:^(BOOL finished){
}];
}];
次の完成セクションに 1 つのアニメーションを入れています。しかし、私は4/5ボタンを持っています。私はこれを何度も行うことはできません。オブジェクトでアニメーションを実行し、0.5 秒後に次のオブジェクトでアニメーションを実行する方法はありますか?
編集:
私はこれを使用しようとしました:
typedef void (^AnimationBlock)();
AnimationBlock firstAnimation = ^{ self.Button1.frame = CGRectMake(-120, self.Button1.frame.origin.y, self.Button1.frame.size.width, self.Button1.frame.size.height); };
AnimationBlock secondAnimation = ^{ self.Button4.frame = CGRectMake(-120, self.Button4.frame.origin.y, self.Button4.frame.size.width, self.Button4.frame.size.height);};
[UIView animateWithDuration:2 animations:firstAnimation completion:^(BOOL finished) {
[UIView animateWithDuration:2 animations:secondAnimation];
}];
ただし、2 つのアニメーション間の時間を設定することはできません。