- - (void)animDur:(float)dur next:(SEL)sel {
- [UIView beginAnimations:nil context:nil];
- [UIView setAnimationDuration:dur];
- [UIView setAnimationDelegate:self];
- [UIView setAnimationDidStopSelector:sel];
- }
- - (void)anim {
- [UIView commitAnimations];
- }
- - (void)sleepDur:(float)dur next:(SEL)next {
- [NSTimer
- scheduledTimerWithTimeInterval:dur
- target:self selector:next userInfo:nil repeats:NO];
- }
- - (void)splash0 {
- [self animDur:0.4 next:@selector(splash1)];
- splash.alpha = 1;
- [self anim];
- }
- - (void)splash1 {
- [self sleepDur:1.5 next:@selector(splash2)];
- }
- - (void)splash2 {
- [self animDur:1.0 next:@selector(splash3)];
- splash.alpha = 0;
- [self anim];
- }
- - (void)splash3 {
- [self animDur:1.0 next:nil];
- mainView.alpha = 1;
- [self anim];
- }
2009年11月6日金曜日
マイ・アニメーションブロック
iPhone アプリ開発で、起動時にスプラッシュスクリーンを入れたいときとか、細かいアニメーションをたくさん入れたい時に、自分用のアニメーションブロックみたいなのを作ると、コードが読みやすくなるし、タイプ量も減って、コードがメンテナンスしやすくなる。
登録:
コメントの投稿 (Atom)
0 件のコメント:
コメントを投稿