FreeAsInBeer
FreeAsInBeer

Reputation: 12979

Scale any view's contents and allow animation

How can I scale a view controller's view. Currently we use a view as one tab in a TabBarController, but we are making our application themable. We want the thumbnails that are selectable to be "live", as in they will display current information and animate as that information changes. I think the easiest way to accomplish this task would be to use the view I have already built. Is there an easy way to scale the view, and does it support animations? I've done a bit of research, and despite hundreds of millions of hits I can't find anything useful on this topic.

Upvotes: 1

Views: 156

Answers (1)

picciano
picciano

Reputation: 22701

Here is an example to that scales and moves the view animated over 1/2 second. Adjust as needed. Optionally, you can put code in the completion block to run when the animation is completed.

[UIView animateWithDuration:0.5f animations:^{
    self.view.transform = CGAffineTransformScale(CGAffineTransformMakeTranslation(100.0f, 100.0f), 0.1f, 0.1f);
} completion:^(BOOL finished){}];

Upvotes: 5

Related Questions