UIView的animateWithDuration:延迟:工作怪异 [英] UIView animateWithDuration:delay: working weird
问题描述
我体验与iPhone动画块一个奇怪的问题。
这code:
I experience a strange problem with iPhone animation blocks. This code:
[UIView animateWithDuration:2 delay: 0 options: 0 animations:
^(void) { [controller setBackgroundColor: [UIColor blueColor]]; }
completion: nil];
[UIView animateWithDuration:2 delay: 2 options: 0 animations:
^(void) { [controller setBackgroundColor: [UIColor redColor]]; }
completion: nil];
即时背景设置为红色,而不经过蓝色状态。
即使是在这个code同样的事情:
Instantly sets the background to red, without passing the blue state. The same thing EVEN for this code:
[UIView animateWithDuration:2 delay: 0 options: 0 animations:
^(void) { [controller setBackgroundColor: [UIColor blueColor]]; }
completion:
^(BOOL wrwg) {
[UIView animateWithDuration:2 delay: 2 options: 0 animations:
^(void) { [controller setBackgroundColor: [UIColor redColor]]; }
completion: nil];
}];
也就是说,在我尝试后的第一个已完成运行第二个动画。
有什么问题?
That is, where I try to run the second animation AFTER the first has finished. What's the problem?
推荐答案
我有同样的问题。使舒尔的控制器类型,否则的UIView动画块PTED为没有动画执行,因此跨$ P $跳过,接下来的动画渲染。
I had the same problem. Make shure that controller is of type UIView otherwise the animation block is interpreted as "no animation to perform" and therefore skipped and the next animation is rendered.
也有看这个帖子,我(通过我的解决方案)问同样的问题:
<一href=\"http://www.iphonedevsdk.com/forum/iphone-sdk-development/64451-animation-one-after-another.html#post265531\">http://www.iphonedevsdk.com/forum/iphone-sdk-development/64451-animation-one-after-another.html#post265531
Also have look to this post where I asked the same question (with solution by me): http://www.iphonedevsdk.com/forum/iphone-sdk-development/64451-animation-one-after-another.html#post265531
这篇关于UIView的animateWithDuration:延迟:工作怪异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!