Reputation: 1665
I am experiencing that when I add a UIActivityIndicatorView
as a subview of one of my UITableViewCell
s then it only spins for a short while and then it stops. Does anyone maybe know why?
This is in principle 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
is an IBOutlet
:
IBOutlet UIActivityIndicatorView *spinner;
Upvotes: 3
Views: 567
Reputation: 72
Try inserting this inside the function.
[spinner startAnimating];
If you want it to stop, call the stopAnimating method.
Upvotes: 2
Reputation: 175
You need to manually start and stop the animation of the UIActivityIndicatroView. Example for your code
Add this where you want to start the animation:
[spinner startAnimating];
Add this where you want to stop the animation:
[spinner stopAnimating];
Hope this helps!
Upvotes: 1