我想为当UIImageView在我的视图中显示时制作一个小的缩放/淡出动画,我已经有了淡入效果的代码:
banner.alpha = 0.0;
[UIView animateWithDuration:2.0 animations:^{
banner.alpha = 1.0;
}];
现在我想知道是否有另一种简单的方法将淡入淡出效果与略微缩放的效果相结合,比如图像在淡入时变大并填充框架?有什么想法吗?谢谢!
我想为当UIImageView在我的视图中显示时制作一个小的缩放/淡出动画,我已经有了淡入效果的代码:
banner.alpha = 0.0;
[UIView animateWithDuration:2.0 animations:^{
banner.alpha = 1.0;
}];
你可以使用 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);
}];
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) {
}];