What are block-based animation methods in iPhone OS 4.0?

I have posted an example in my blog:

    CGPoint originalCenter = icon.center;
    [UIView animateWithDuration:2.0
            animations:^{ 
                CGPoint center = icon.center;
                center.y += 60;
                icon.center = center;
            } 
            completion:^(BOOL finished){

                [UIView animateWithDuration:2.0
                        animations:^{ 
                            icon.center = originalCenter;
                        } 
                        completion:^(BOOL finished){
                            ;
                        }];

            }];

The above code will animate a UIImageView* (icon) in a 2-second animation. Once completed, another animation will move the icon back to it’s original position.

Leave a Comment