アニメーションの例として、UIImageViewでやってみます。
1)ストーリボードで、この様な感じでOutletを用意します。
2)ViewController.mはこんな感じで書きます。
UIImageViewとなってる所は、アニメーションにしたい対象のクラス(UIViewとか)に変えればよいです。
// アニメーション ブロック スタート [UIImageView beginAnimations:nil context:NULL];//アニメーション内容の指定開始 [UIImageView setAnimationDuration:3.0];//アニメーション時間(秒)
//■■■ここから実際にアニメーションしたい内容を書きます。 //透明▷不透明 _imgV.alpha = 0.0;//初期 透明 _imgV.alpha = 1.0;//最終 不透明
//拡大 _imgV.transform = CGAffineTransformMakeScale(0.0,0.0);//初期 拡大 _imgV.transform = CGAffineTransformMakeScale(1.0,1.0);//最終 拡大
//■■■ここまで実際にアニメーションしたい内容を書きます。
[UIImageView commitAnimations]; //アニメーション実行 // アニメーション ブロック エンド |
3)これを動かすとこんな感じです。