iOS缩小动画

iOS缩小动画,ios,animation,imageview,transform,Ios,Animation,Imageview,Transform,我试图放大一个圆形的剖面图像视图,当用户点击它时,然后当他点击屏幕上的任何其他地方时,图像视图必须恢复到正常大小。必须为两个方向上的缩放设置动画 这是我用来放大imageview的代码: CGRect frame = CGRectMake(0, 0, 200, 200); imageView.frame = frame; imageView.transform = CGAffineTransformMakeScale(0, 0); [UIView animateW

我试图放大一个圆形的剖面图像视图,当用户点击它时,然后当他点击屏幕上的任何其他地方时,图像视图必须恢复到正常大小。必须为两个方向上的缩放设置动画

这是我用来放大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);
    }];

放大可以正常工作,但缩小没有设置动画。它就这样消失了。有人能帮忙吗?

在第二个动画中试试这个:

CGRect frame = CGRectMake(0, 0, 50, 50);
self.imageView.frame = frame;
self.imageView.transform = CGAffineTransformMakeScale(4, 4);
[UIView animateWithDuration:0.5 animations:^{

        self.imageView.transform = .identity
}];

尝试不设置图像视图的帧,只设置如下变换以展开:

[UIView animateWithDuration:0.5 animations:^{
        _settingsProfilePlaceholderImageView.transform = CGAffineTransformMakeScale(2, 2);
    }];
签订合同:

[UIView animateWithDuration:0.5 animations:^{
        _settingsProfilePlaceholderImageView.transform = CGAffineTransformMakeScale(1, 1);
    }];

谢谢你的回复。但是,行为还是一样的。