GAffineTransformMakeScale动画无法正常工

GAffineTransformMakeScale动画无法正常工

本文介绍了CGAffineTransformMakeScale动画无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个viewcontroller,其视图是我在使用UIView动画时将其缩小为0,然后再删除它。解雇它的代码是:

I have a viewcontroller with a view that I am dismissing using a UIView animation to scale it down to 0 before removing it. My code for dismissing it is:

[UIView animateWithDuration:_dismissAnimationDuration
                      delay:0.0
                    options:UIViewAnimationOptionCurveEaseIn
                 animations:^(void) {
                     _menuContainerView.transform = CGAffineTransformMakeScale(0.0, 0.0);
                 }
                 completion:^(BOOL finished){
                     if ([_delegate respondsToSelector:@selector(popUpMenuDidClose)])
                     {
                         [_delegate popUpMenuDidClose];
                     }

                     [self.view removeFromSuperview];
                     [self removeFromParentViewController];
                 }];

从XCode 5构建到运行iOS 7和iOS 8的设备时,这非常有效。但是,as as一旦我从XCode 6(beta 6和beta 7)构建到iOS 8,视图就会切掉而不是动画。如果一旦我将目标比例改为(0.001,0.001)就不够奇怪,无论XCode版本如何,它都会动画很好。关于为什么我不能使用XCode 6动画到实际(0.0,0.0)比例的任何想法?

That works perfectly when building from XCode 5 onto devices running both iOS 7 and iOS 8. But, as soon as I build to iOS 8 from XCode 6 (beta 6 and beta 7) the view just cuts away instead of animating. If that wasn't weird enough as soon as I change the target scale to (0.001, 0.001) it animates fine regardless of XCode version. Any ideas as to why I can't animate to an actual (0.0, 0.0) scale with XCode 6?

推荐答案

所以之后与Apple的开发人员交谈,我得到的理由是,一些基础框架需要经常使用变换矩阵的逆,并且由于零矩阵没有反转,动画只会返回以避免崩溃。希望这篇文章能帮助遇到类似情况的其他人。

So after speaking with a developer at Apple the reasoning I got back was that some base frameworks need to work with the inverses of transform matrices quite often, and since there is no inverse for the zero matrix the animation just returns out to avoid crashing. Hopefully this post has helped others who ran into a similar situation.

这篇关于CGAffineTransformMakeScale动画无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 14:35