show activity indicator while loading ViewController
- by Crystal
I have a ViewController that takes time to load its views.  When I run Instruments, I see from the home screen, if I tap on the icon that pushes that view controller onto the stack, it's half laying out the views, and half getting the data for the views.  I tried adding an activity indicator to display on the home screen over the button when the button is pressed to push the LongRunningViewController onto the stack.  So I basically do this:
- (IBAction)puzzleView:(id)sender {
    dispatch_async(dispatch_get_main_queue(), ^{
        [self.activityIndicator startAnimating];
    });
    PuzzleViewController *detailViewController = [[[PuzzleViewController alloc] init] autorelease];
    [self.navigationController pushViewController:detailViewController animated:YES];
    [self.activityIndicator stopAnimating];
}