遇到UIView,animateWithDuration并完成

我不知道这段代码有什么问题。

[UIView animateWithDuration:10.0f delay:0.0f options:UIViewAnimationOptionTransitionNone animations:^{ CGAffineTransform transform = CGAffineTransformMakeScale(0.1, 0.1); self.transform = transform; } completion:^(BOOL finished) { if (finished) { NSLog(@"Animation finished"); [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:@"NSShowHomeScreen" object:nil ]; } }]; 

即使持续10秒,animation开始时我立即收到控制台消息“animation完成”。

我想缩小/缩放我的第一个UIView,然后我想显示另一个UIView。 但是现在第二个UIView在收缩结束之前显示得很好。

任何帮助将不胜感激。

谢谢

在UIView文档中,对于transform属性,说:

对这个属性的改变可以是animation的。 使用beginAnimations:context:类方法开始,使用commitAnimations类方法结束animation块。 缺省值是无论中心值是什么(或如果更改了锚点)

所以也许它不能使用块方法进行animation制作,而且你将不得不在animation周围使用开始和提交包装

对不起,这是我的不好。 我也在使用UIPinchGestureRecognizer导致问题。 无论如何感谢您的快速回复..

谢谢