Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c 延迟触发一个又一个动画_Objective C_Ios_Xcode_Animation - Fatal编程技术网

Objective c 延迟触发一个又一个动画

Objective c 延迟触发一个又一个动画,objective-c,ios,xcode,animation,Objective C,Ios,Xcode,Animation,我有两个同时淡入显示的对象,它们最初设置为隐藏,我想在第一个动画几秒钟后触发第二个动画,但它们同时淡入 _text.alpha = 0; _text.hidden = NO; [UIView animateWithDuration:1.9 animations:^{ _text.alpha = 1; }]; ////////////second animation _note.alpha = 0; _note.hidden = NO; [UIView setAnimatio

我有两个同时淡入显示的对象,它们最初设置为隐藏,我想在第一个动画几秒钟后触发第二个动画,但它们同时淡入

_text.alpha = 0;

_text.hidden = NO;

[UIView animateWithDuration:1.9 animations:^{
   _text.alpha = 1;


}];

////////////second animation

_note.alpha = 0;

_note.hidden = NO;

[UIView setAnimationDelay:2.0];

[UIView animateWithDuration:1.9 animations:^{
    _note.alpha = 1;


}];
使用animateWithDuration:animations:completion:方法,如中所述。将第二个动画放入第一个动画的完成块。

使用动画宽度持续时间:动画:完成:方法,如中所述。将第二个动画放入第一个动画的完成块。

尝试以下操作:

[UIView animateWithDuration:1.9 animations:^{
    _text.alpha = 1;    
} completion:^(BOOL finished) {

    [UIView animateWithDuration:1.9 animations:^{
       _note.alpha = 1;
    }];

}];
第一个动画结束时调用第二个块

试试这个:

[UIView animateWithDuration:1.9 animations:^{
    _text.alpha = 1;    
} completion:^(BOOL finished) {

    [UIView animateWithDuration:1.9 animations:^{
       _note.alpha = 1;
    }];

}];

第一个动画结束时调用第二个块

对不起,我想说的是确保…:D查看此动画,持续时间:动画:完成:-!对不起,我想说的是确保…:D查看此动画,持续时间:动画:完成:-!啊,就是这样,这帮助我理解了动画块的原理。非常感谢这一点啊,正是这一点,帮助我理解了动画块的原理。非常感谢