I have one table view and in that table view i have one UIActivityIndicator with one button in every cell . Now on click on that button i want to start ActivityIndicator animating, its starting. But the problem is when i scroll the table view it stops animating. Here is my code for cellForRowAtIndexPath
- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"txDevicesListCellID"];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"txDevicesListCellID"];
}
UIButton *buttonutton = (UIButton *)[cell viewWithTag:103];
UIActivityIndicatorView *activityIndicator = (UIActivityIndicatorView *) [cell viewWithTag:104];
button.tag = indexPath.row;
return cell;
}
and selector method for my button is
-(IBAction)recevierButtonClick:(id)sender{
UIButton *button = (UIButton *)sender;
NSInteger index = button.tag;
NSIndexPath* indexpath = [NSIndexPath indexPathForRow:serialNumber inSection:0];
UITableViewCell* cell = [self.myTableView cellForRowAtIndexPath:indexpath];
activityIndicator = (UIActivityIndicatorView*)[cell viewWithTag:index];
[activityIndicator startAnimating];
}