我想在我的视图中显示UIImageView时制作一个小缩放/淡入淡出动画,我已经有了淡入淡出效果的代码:
banner.alpha = 0.0;
[UIView animateWithDuration:2.0 animations:^{
banner.alpha = 1.0;
}];
现在我想知道是否还有另一种简单的方法可以将淡入淡出效果与一点变焦效果结合起来,比如图像变大并在渐弱时填满画面?有任何想法吗? 谢谢!
答案 0 :(得分:11)
您可以使用CG_EXTERN CGAffineTransform CGAffineTransformMakeScale(CGFloat sx, CGFloat sy)
进行缩放效果
,例如
banner.alpha = 0.0;
[UIView animateWithDuration:2.0 animations:^{
banner.alpha = 1.0;
banner.transform =CGAffineTransformMakeScale(1.3,1.3);
}];
答案 1 :(得分:4)
您也可以使用框架
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) {
}];