我试图在视图上执行此动画,将其缩放到 (0,0),然后使用 CGRectMake 方法移动此帧并将其缩放回 (1,1)。所以我使用下面的代码来做到这一点
-(void)startWalkAnimationStartWalkingBtnViewScaleToZero{
    CGAffineTransform transform = StartWalkBtnView.transform;
    StartWalkBtnView.transform=CGAffineTransformScale(transform,1.0f, 1.0f);
    [UIView animateWithDuration: 0.7
                          delay: 0.6
                        options: (UIViewAnimationOptionCurveLinear | UIViewAnimationOptionAllowUserInteraction)
                     animations:^{ StartWalkBtnView.transform = CGAffineTransformScale(transform, 0.0f, 0.0f);
                     }
                     completion:^(BOOL finished){
                         [UIView animateWithDuration:0.0
                                               delay:0.0
                                             options: UIViewAnimationOptionCurveEaseIn
                                          animations:^{
                                              StartWalkBtnView.frame=CGRectMake(92, 270, 120, 121);
                                          }
                                          completion:^(BOOL finished){
                                              StartWalkBtnView.transform=CGAffineTransformScale(transform,0.0f, 0.0f);
                                              [UIView animateWithDuration: 0.7
                                                                    delay: 0.8
                                                                  options: (UIViewAnimationOptionCurveLinear | UIViewAnimationOptionAllowUserInteraction)
                                                               animations:^{ StartWalkBtnView.transform = CGAffineTransformScale(transform, 1.0f, 1.0f);
                                                               }
                                                               completion:^(BOOL finished){}
                                               ];
                                          }];
                     }
     ];
}
但是在尝试运行此动画后,我在控制台中收到以下错误。
Jun 17 12:02:49 Kareem.local MyAppName[3157] <Error>: CGAffineTransformInvert: singular matrix.
我在谷歌上搜索了太多,并尝试了提供的所有解决方案(Scale Near to zere Value,...)但没有任何效果,有没有人有解决这个问题的想法。感谢帮助
更新: 我发现以下行中的问题:
StartWalkBtnView.frame=CGRectMake(92, 270, 120, 121);
但实际上我不知道如何解决这个问题,但是当我删除这条线时它缩放到零然后从零正常返回,没有任何错误