【发布时间】:2015-09-23 08:42:07
【问题描述】:
当用户点击它时,我试图放大一个圆形的个人资料 imageview,然后当他点击屏幕上的其他任何地方时,imageview 必须恢复到正常大小。两个方向的缩放都必须是动画的。
这是我用来放大图像视图的代码:
CGRect frame = CGRectMake(0, 0, 200, 200);
imageView.frame = frame;
imageView.transform = CGAffineTransformMakeScale(0, 0);
[UIView animateWithDuration:0.5 animations:^{
imageView.transform = CGAffineTransformMakeScale(1, 1);
}];
恢复正常大小的代码:
CGRect frame = CGRectMake(0, 0, 50, 50);
imageView.frame = frame;
imageView.transform = CGAffineTransformMakeScale(1, 1);
[UIView animateWithDuration:0.5 animations:^{
imageView.transform = CGAffineTransformMakeScale(0, 0);
}];
按比例放大工作正常,但按比例缩小没有动画效果。它只是消失了。有人可以帮忙吗?
【问题讨论】:
标签: ios animation imageview transform