1

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

_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;


}];
4

2 回答 2

4

尝试这个:

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

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

}];

当第一个动画结束时,第二个块被调用。

于 2012-12-02T19:52:53.163 回答
2

使用苹果文档animateWithDuration:animations:completion:中描述的方法。将第二个动画放入第一个动画的完成块中。

于 2012-12-02T19:52:28.240 回答