UIActivityIndicatorView stops rotating

I experience this when I add UIActivityIndicatorView

one of mine as a subtitle UITableViewCell

, then it only rotates for a short time and then stops. Can anyone know why?

This is basically what I am doing in my code:

- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MyCell" forIndexPath:indexPath];

    if (indexPath.row == 0) cell.accessoryView = spinner;

    UILabel *label = (UILabel *)[cell viewWithTag:1];
    label.text = @"Some text";

    return cell;
}

      

where spinner

- IBOutlet

:

IBOutlet UIActivityIndicatorView *spinner;

      

+3


source to share


2 answers


Try putting this inside a function.

[spinner startAnimating];

      



If you want it to stop, call the stopAnimating method.

+1


source


You need to manually start and stop the animation of the UIActivityIndicatroView. An example for your code

Add this where you want to start your animation:

[spinner startAnimating];

      



Add this where you want the animation to stop:

[spinner stopAnimating];

      

Hope this helps!

+1


source







All Articles