iOS在动画之后执行动画,每个动画之间有延迟

时间:2014-04-30 13:10:43

标签: ios objective-c uianimation

我有一个数组,其中包含一些按钮的标签,例如:[8,5,12,4,14,29,3,2,24,2,7];

想象一下我的所有按钮都被隐藏了。 我只是想取消隐藏我的按钮,这些按钮的标签是带有淡入淡出动画的数组。 每个按钮应该取消隐藏另一个按钮。

当我为它创建一个循环时,所有动画都相互执行,它会将所有按钮完全取消隐藏,或者不会有任何延迟。

我该怎么办?

这是我的代码:

- (void)AnimateArrayforIndex: (int)index{
        [UIView animateWithDuration:1 delay:1 options:UIViewAnimationOptionTransitionCrossDissolve | UIViewAnimationOptionAllowAnimatedContent animations:^{
            [self hideAllButtons];
            [self unHideButtonWithTag:[_arr objectAtIndex:index]];

        } completion:^(BOOL animationFinished) {
            if (animationFinished){
                if (index<[_arr count]-1)
                    [self AnimateArrayforIndex:index+1];
            }
        }];

}

感谢任何帮助,

0 个答案:

没有答案