animateWithDuration无法淡入淡出

时间:2013-09-13 07:56:16

标签: ios uilabel animatewithduration

我想在我的标签上进行淡出淡出然后淡入淡出,我可以让它们分开工作但不能一起工作。

    [UILabel animateWithDuration:1.0 animations:^{
        _swixValla.alpha = 0.0;
        _skigoValla.alpha = 0.0;
        _rodeValla.alpha = 0.0;
        _startValla.alpha = 0.0;
    }];


    [UILabel animateWithDuration:1.0 animations:^{
        _swixValla.alpha = 1.0;
        _skigoValla.alpha = 1.0;
        _rodeValla.alpha = 1.0;
        _startValla.alpha = 1.0;
    }];

这不起作用

    [UILabel animateWithDuration:1.0 animations:^{
        _swixValla.alpha = 0.0;
        _skigoValla.alpha = 0.0;
        _rodeValla.alpha = 0.0;
        _startValla.alpha = 0.0;


    [UILabel animateWithDuration:1.0 animations:^{
        _swixValla.alpha = 1.0;
        _skigoValla.alpha = 1.0;
        _rodeValla.alpha = 1.0;
        _startValla.alpha = 1.0;
    }];
    }];

这也不起作用。

我该如何解决这个问题?

1 个答案:

答案 0 :(得分:2)

如果你想在完成第一个之后将它们组合起来使用:

[UIView animateWithDuration:1.0 animations:^{
    _swixValla.alpha = 0.0;
    _skigoValla.alpha = 0.0;
    _rodeValla.alpha = 0.0;
    _startValla.alpha = 0.0;
}completion:^(BOOL finished){
    [UILabel animateWithDuration:1.0 animations:^{
        _swixValla.alpha = 1.0;
        _skigoValla.alpha = 1.0;
        _rodeValla.alpha = 1.0;
        _startValla.alpha = 1.0;
    }];
}];