UIViewのアニメーション

すぐ忘れるのでメモ

iOS4以降でのUIViewアニメーション
the block-based animation methods

[UIView animateWithDuration:0.2
            animations:^{ 
  //アニメーション操作
            } 
            completion:^(BOOL finished){
  //アニメーション終了時操作
                [UIView animateWithDuration:0.2
                        animations:^{ 
   //2段階目アニメーション操作

                        } 
                        completion:^(BOOL finished){
                            ;
                        }];

            }];

iOS Viewプログラミングガイドに載ってるカスタムオプションサンプル

// ビューをただちにフェードアウトする。
[UIView animateWithDuration:1.0
        delay: 0.0
        options: UIViewAnimationOptionCurveEaseIn
        animations:^{
             thirdView.alpha = 0.0;
        }
 completion:^(BOOL finished){
  // 1秒待ってから、ビューをフェードインする。
  [UIView animateWithDuration:1.0
  delay: 1.0
  options:UIViewAnimationOptionCurveEaseOut
  animations:^{
      thirdView.alpha = 1.0;
  }
  completion:nil];
 }];

スポンサーリンク

シェアする

  • このエントリーをはてなブックマークに追加

フォローする