views:

25

answers:

1

Hi there, I'm trying to add a continous animation onto my UITableViewCell-Subclass. It's a rather easy one with an Image fading in and out (fading between 0.4 alpha and 1.0), what i've tried so far ist the following:

-(void)animateRecordingIndicator{

    [UIView beginAnimations:@"RecordingIndicatorAnimation" context:nil];
    [UIView setAnimationDuration:0.3];

    [UIView setAnimationDelegate:self]; 
    [UIView setAnimationDidStopSelector:@selector(animationFinished)];

    if (animatedImageView.alpha == 0.4) 
        animatedImageView.alpha = 1.0;
    else 
        animatedImageView.alpha = 0.4;    

    [UIView commitAnimations];
}

the code within animationFinished is as follows:

-(void)animationFinished{
    if (doShowAnimation) {
        [self performSelectorOnMainThread:@selector(animateRecordingIndicator) withObject:nil waitUntilDone:YES];
    }
}

what I expect should be clear by now, but what i get is simply a crash with XCODE loading Stackframes more or less eternaly :)

I'm very thankful for every kind of advice, tipp or trick how to deal with this.

thanks in advance,

sam

+1  A: 

According to the UIView class reference, you are now discouraged from using the commitAnimations method. Instead use the following:

animateWithDuration:delay:options:animations:completion:

I imagine the infinite recursion you are encountering is related to Apple's reasons for making that recommendation.

William Jockusch
thanks for your hint, its animating now. unfortunately the application blocks after the animation starts and user input is no longer possible. also only the first of n tableViewCells get the animation to work.
samsam