Ios 如何设置一个又一个UILabel的动画

Ios 如何设置一个又一个UILabel的动画,ios,objective-c,uilabel,Ios,Objective C,Uilabel,我目前正在制作两个UILabel的动画,如下所示: [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:2.0]; [_temperatureLabel setAlpha:1]; [_tempDescriptionLabel setAlpha:1]; [UIView commitAnimations]; 但是,我想显示第一个标签\u temperatureLabel,然后一旦完成动画制作(或者可能是中途

我目前正在制作两个
UILabel
的动画,如下所示:

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:2.0];
[_temperatureLabel setAlpha:1];
[_tempDescriptionLabel setAlpha:1];
[UIView commitAnimations];
但是,我想显示第一个标签
\u temperatureLabel
,然后一旦完成动画制作(或者可能是中途),就开始制作第二个标签
\u tempDescriptionLabel
的动画,正如我说的,我将回答:

 [UIView animateWithDuration:2 delay:0 options:UIViewAnimationOptionCurveEaseIn animations:^{

         //set alpha 1 for first UILabel
         _temperatureLabel.alpha = 1;

        } completion:^(BOOL finished){

        [UIView animateWithDuration:2 delay:0 options:UIViewAnimationOptionCurveEaseIn animations:^{

                //when finished enter here
            //set alpha 1 for second UILabel
            _tempDescriptionLabel.alpha = 1;

            } completion:^(BOOL finished){


            }];

        }];

记住添加
QuartzCore
框架,并添加
#import

用于中途或任何其他中途时间

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:2.0];
[_temperatureLabel setAlpha:1];
[UIView commitAnimations];
[self performSelector:@selector(halfWayStart:) withObject:nil afterDelay:1.0];

-(void)halfWayStart:(id)object{
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:2.0];
    [_tempDescriptionLabel setAlpha:1];
    [UIView commitAnimations];
}

因此,在
performSelector
调用中更改
afterDelay
时间值将帮助您随时启动其他动画。

@Ilario answer绝对是最简单的方法。如果您想在第一个动画进行一半时开始一次,则需要更多的参与。我会在这个例子中使用关键帧:“我的特殊目的是的,我知道,我的答案很容易,而且不允许在另一个中间启动动画,但是它是有效的。obv@Ilario我不是想冒犯你,抱歉我冒犯了你!我同意你的观点,我也会这么做。我只是简单地指出,OP说他可能想让动画中途开始。我只是简单地指出了一种他可以使用的方法。@MySpecialPurpose哦,不,不,你弄错了,我没有生气,我是说你是对的,我只展示了按顺序制作动画的最简单方法;-)工作起来很有魅力!虽然我不需要导入QuartzCore(虽然它是被添加的),但我通过让标签alpha达到.5,并让它在下一个块中达到1,来伪造了一半的持续时间