1

最初に設定されている2つのオブジェクトが同時に表示にフェードインします。最初hiddenのアニメーションの数秒後に、2番目のアニメーションを起動したいのですが、両方が同時にフェードインしますか?

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

}];

2番目のブロックは、最初のアニメーションが終了したときに呼び出されます。

于 2012-12-02T19:52:53.163 に答える
2

アップルのドキュメントanimateWithDuration:animations:completion:で説明されている方法を使用します。2番目のアニメーションを最初のアニメーションの完了ブロックに配置します。

于 2012-12-02T19:52:28.240 に答える