我想做一个小的缩放/淡入淡出动画,当UIImageView出现在我的视图中时,我已经有了淡入淡出效果的代码:
banner.alpha = 0.0;
[UIView animateWithDuration:2.0 animations:^{
banner.alpha = 1.0;
}];现在我想知道是否有另一种简单的方法来组合淡入淡出效果和小缩放效果,比如图像变大并在淡入时填满框架?有什么想法吗?谢谢!
发布于 2013-01-31 15:18:22
您可以使用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-31 17:21:14
您还可以使用框架
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) {
}];https://stackoverflow.com/questions/14620354
复制相似问题