Pregunta

I want to preform a fade out followed by a fade in on my label, i can get both to work separately but not together.

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

This does not work

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

This does not work either.

How can i solve this?

¿Fue útil?

Solución

If you want to combine them to start the second one after first one is done use:

[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;
    }];
}];
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top