title: XCode Custom Activity Indicator - Hide after UIWebView Loads (webViewDidFinishLoad)
body: <p>I'm using the code found here <a href="http://blog.blackwhale.at/?p=336" rel="nofollow noreferrer">http://blog.blackwhale.at/?p=336</a> to create a custom <code>activityIndicator</code> in the current version of xCode. This code uses a series of <code>.png</code> images in an array and then displays them at the set interval to create an animated loading image that you can then place on the screen (and assuming you can somehow remove it) whenever you want.</p>
  <p>In my main ViewController.m file I have the following code in my <code>viewDidLoad</code> section :</p>
  <pre><code>/* --- START CUSTOM ACTIVITY INDICATOR */
      //Create the first status image and the indicator view
      UIImage *statusImage = [UIImage imageNamed:@&quot;activity1.png&quot;];
      UIImageView *activityImageView = [[UIImageView alloc] 
                                        initWithImage:statusImage];
      
      
      //Add more images which will be used for the animation
      activityImageView.animationImages = [NSArray arrayWithObjects:
                                           [UIImage imageNamed:@&quot;activity1.png&quot;],
                                           [UIImage imageNamed:@&quot;activity2.png&quot;],
                                           [UIImage imageNamed:@&quot;activity3.png&quot;],
                                           [UIImage imageNamed:@&quot;activity4.png&quot;],
                                           [UIImage imageNamed:@&quot;activity5.png&quot;],
                                           [UIImage imageNamed:@&quot;activity6.png&quot;],
                                           [UIImage imageNamed:@&quot;activity7.png&quot;],
                                           [UIImage imageNamed:@&quot;activity8.png&quot;],
                                           [UIImage imageNamed:@&quot;activity9.png&quot;],
                                           [UIImage imageNamed:@&quot;activity10.png&quot;],
                                           [UIImage imageNamed:@&quot;activity11.png&quot;],
                                           [UIImage imageNamed:@&quot;activity12.png&quot;],
                                           nil];
      
      
      //Set the duration of the animation (play with it
      //until it looks nice for you)
      activityImageView.animationDuration = 0.6;
      
      
      //Position the activity image view somewhere in 
      //the middle of your current view
      activityImageView.frame = CGRectMake(
                                           self.view.frame.size.width/2
                                           -statusImage.size.width/2, 
                                           self.view.frame.size.height/1.2
                                           -statusImage.size.height/1.2, 
                                           statusImage.size.width, 
                                           statusImage.size.height);
      
      //Start the animation
      [activityImageView startAnimating];
      
      
      //Add your custom activity indicator to your current view
      [self.view addSubview:activityImageView];
  
      
     /*  --- END CUSTOM ACTIVITY INDICATOR */
  </code></pre>
  <p>I would like to CLEAR/DELETE/HIDE the <code>activityImageView</code> element, as I only want it to show when the app first launches until the <code>UIWebView</code> finishes loading.</p>
  <p>I would like to call this and have the gif appear while <code>webViewDidStartLoad</code> and then clear when <code>webViewDidFinishLoad</code>.  Someone help??</p>