iPhone Developer's Cookbook 第二章

まだまだ第二章。

動きがないとやっぱり面白くないので、今日はアニメーション。

アニメーションは簡単。beginAnimationsからcommitAnimationsの間にアニメーションの設定を書いておけばそれでおしまい、って感覚でよいのかな?

    CGContextRef context = UIGraphicsGetCurrentContext();
    [UIView beginAnimations:nil context:context];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
    [UIView setAnimationDuration:1.0];
    [[self viewWithTag:IMAGE_VIEW_TAG] setAlpha:(float)isVisible];
    [UIView commitAnimations];

AnimationCurveはアニメーションの動作スピードの調整。最初はゆっくりで徐々に早くするとかって感じの設定をする。setAnimationDurationはアニメーションの動作継続時間。単位は秒。

・・・って、英語の単語そのまんまだからわかりやすいね。Objective-Cはこういう冗長性があるから、タイプするのは大変だけど、意味は理解しやすい。

iPhone Developer’s Cookbook, The: Building Applications with the iPhone SDK (Developer's Library)

iPhone Developer’s Cookbook, The: Building Applications with the iPhone SDK (Developer's Library)