UIView簡易アニメーション
UIViewやUIImageViewなど、UIView属性のものを簡単にアニメーションしてしまうためのコード。
Delegateする記述を書くことで、アニメーションが終了したあとに何か動作させることも可能です。
もちろん、アニメーション前の実行もできます。
メソッド名は何を定義しているかわかりやすいので迷うことはないはずです。
1 2 3 4 5 6 7 8 9 10 11 12 13 | // 簡易アニメーション CGContextRef context = UIGraphicsGetCurrentContext(); [UIView beginAnimations:nil context:context]; [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; [UIView setAnimationDuration:1.0f]; [UIView setAnimationDelegate:self]; [UIView setAnimationWillStartSelector:@selector(someBefore)]; [UIView setAnimationRepeatCount:0]; [UIView setAnimationDelay:1]; [UIView setAnimationRepeatAutoreverses:NO]; [UIView setAnimationDidStopSelector:@selector(someCode)]; // ここにアニメーション処理を記述 [UIView commitAnimations]; |