title: Animate Spinner when loading new page
body: <p>I have a UITableView which from an external RSS feed.</p>
  
  <p>When you select a row it uses navigationController and slides in from the right, the problem is that the RSS feed contains images therefore it can can take a few seconds to load and without any indication of what is going on you can mistake it for an application crash.</p>
  
  <p>I decided to add a spinner so that you know that new page is loading.</p>
  
  <p>Here is my code:</p>
  
  <p>RootViewController.m</p>
  
  <pre><code>- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
  NSLog(@"Loading New Page");
  
  [tableView deselectRowAtIndexPath:indexPath animated:YES];
  DetailsViewController *detailViewController = [[DetailsViewController alloc] initWithNibName:@"DetailsViewController" bundle:nil];
  detailViewController.item = [rssItems objectAtIndex:floor(indexPath.row/2)];
  [self.navigationController pushViewController:detailViewController animated:YES];
  [detailViewController release];
  
  UIActivityIndicatorView *spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
  spinner.center = CGPointMake(160, 240);
  [self.view addSubview:spinner];
  [spinner startAnimating];
  [spinner release];
  
  }
  </code></pre>
  
  <p>DetailsViewController.m</p>
  
  <pre><code>- (void)viewDidLoad {
      [super viewDidLoad];
  
          NSString *imgURL = [item objectForKey:@"image"];
          NSData *mydata = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:imgURL]];
          item_photo.image = [[UIImage alloc] initWithData:mydata];
  
      item_title.text = [item objectForKey:@"title"];
      item_date.text = [NSString stringWithFormat:@"Date: %@",[item objectForKey:@"date"]];
      item_time.text = [NSString stringWithFormat:@"Time: %@",[item objectForKey:@"time"]];
      item_cost.text = [NSString stringWithFormat:@"Cost: £%@",[item objectForKey:@"cost"]];
      item_info.text = [item objectForKey:@"description"];
      self.navigationItem.title = @"Event Type";
  }
  </code></pre>
  
  <p>There are two problems with this code.</p>
  
  <ol>
  <li>The Spinner does not active until after the new page has loaded.</li>
  <li>The Spinner does not disable once loaded.</li>
  </ol>
  
  <p>If anyone could help me with this problem i would be truly gratefully.</p>