In the method viewDidLoad I initialize an ActivityIndicatorView.Then, in the following method I sent the activity indicator to start. When I start the app and it runs the if statement, the activity indicator starts, but when operations in the dispatch queue are performed, the activityIndicator is not stopped. Here the method:
-(void) tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
if([indexPath row] == [_myArray count]-2){
[_activityIndicator startAnimating];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{
//Here I perform some operations
[self.tableView reloadData];
[_activityIndicator stopAnimating];
});
}
}
I wish that the activity indicator is stopped after the execution of operations in the dispatch queue!