1

It is clear how to do a zoom in/scaling animation and how to animate an image changing to another. But I need an image to zoom in and midway transform to another. How can it be done?

Community
  • 1
  • 1
Harikrishnan R
  • 150
  • 1
  • 12

2 Answers2

1

This code will work for you.

[UIView animateWithDuration:2.0 animations:^{
    imgView.transform = CGAffineTransformMakeScale(1.5, 1.5);
}
                 completion:^(BOOL finished){
                     [UIView transitionWithView:self.view
                                       duration:2.0f
                                        options:UIViewAnimationOptionTransitionCrossDissolve
                                     animations:^{
                                         [imgView setImage:[UIImage imageNamed:@"default_avatar"]];
                                         imgView.transform = CGAffineTransformMakeScale(2.0, 2.0);
                                     } completion:nil];
                        }];
Jignesh Mayani
  • 6,937
  • 1
  • 20
  • 36
0

Try this code :

 [UIView animateWithDuration:2.0 animations:^{
        self.imgView.transform = CGAffineTransformMakeScale(1.5, 1.5);
    }
                     completion:^(BOOL finished){

                         _imgView.image = [UIImage imageNamed:@"3D_search"];
                         [UIView animateWithDuration:2.0 animations:^{

                             self.imgView.transform = CGAffineTransformMakeScale(2.0, 2.0);
                         }];
                     }];
Arun
  • 2,271
  • 1
  • 14
  • 18