UIActivityIndicator on UITableViewCell not displaying while calling a webService

Posted by Yoyi Cheika on Stack Overflow See other posts from Stack Overflow or by Yoyi Cheika
Published on 2010-06-18T01:00:21Z Indexed on 2010/06/18 1:03 UTC
Read the original article Hit count: 389

Hi coders,

I guess my problem is very simple to solve but I haven been able to do so. Here is my problem:

I have a custom table view cell that contains a UIActivityIndicator. When a cell is selected I push another view but this second view makes a call to a web service to bring data. Here is my code

// Override to support row selection in the table view. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

// Navigation logic may go here -- for example, create and push another view controller. // AnotherViewController *anotherViewController = [[AnotherViewController alloc] initWithNibName:@"AnotherView" bundle:nil]; // [self.navigationController pushViewController:anotherViewController animated:YES]; // [anotherViewController release];

Models *models = [[Models alloc] initWithNibName:@"Models" bundle:nil];

models.make = ((MakeCell *)[tableView cellForRowAtIndexPath:indexPath]).make.text; models.year = (int)[self.yearLabel.text doubleValue]; models.logo = [makeLogosName objectAtIndex:indexPath.row];

[((MakeCell *)[tableView cellForRowAtIndexPath:indexPath]).activityIndicator startAnimating]; [self.navigationController pushViewController:models animated:YES]; [((MakeCell *)[tableView cellForRowAtIndexPath:indexPath]).activityIndicator stopAnimating]; [models release]; }

Where MakeCell is my custom cell. If I comment this line

[((MakeCell *)[tableView cellForRowAtIndexPath:indexPath]).activityIndicator stopAnimating];

then the indicator appears as expected when going back to the previous view. I feel like the indicator is not being visually updated until the didSelectRowAtIndexPath returns. Does is works ascyncronically. What can be my problem here.

Thank you very much

Cheika

© Stack Overflow or respective owner

Related posts about uitableviewcell

Related posts about webservices