UIImageView Zoom / Fade animation?

I want to make a small increase / fade animation, when the UIImageView appears in my opinion, I already have code for the fade effect:

banner.alpha = 0.0; [UIView animateWithDuration:2.0 animations:^{ banner.alpha = 1.0; }]; 

Now I want to know if there is another easy way to combine the fading effect with a small zoom effect, for example, the image gets larger and fills the frame when it disappears? Any ideas? Thanks!

+4
source share
2 answers

you can use CG_EXTERN CGAffineTransform CGAffineTransformMakeScale(CGFloat sx, CGFloat sy) to perform the zoom effect

such as

 banner.alpha = 0.0; [UIView animateWithDuration:2.0 animations:^{ banner.alpha = 1.0; banner.transform =CGAffineTransformMakeScale(1.3,1.3); }]; 
+11
source

You can also use a frame.

 banner.alpha = 0; [UIView animateWithDuration:2.0f animations:^(void){ banner.alpha = 1.0f; [banner setFrame:CGRectMake(0, 0, 1024, 748)]; }]; // With Completion [UIView animateWithDuration:0.1f animations:^(void){ banner.alpha = 1.0f; [banner setFrame:CGRectMake(0, 0, 1024, 748)]; }completion:^(BOOL finished) { }]; 
+4
source

All Articles