4

当 UIImageView 出现在我的视图中时,我想制作一点缩放/淡入淡出动画,我已经有了淡入淡出效果的代码:

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

现在我想知道是否有另一种简单的方法可以将淡入淡出效果与一点缩放效果结合起来,比如图像变大并在淡入时填充框架?有任何想法吗?谢谢!

4

2 回答 2

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);
}];
于 2013-01-31T07:18:21.677 回答
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) {

}];
于 2013-01-31T09:21:14.397 回答