title: Adding an Activity Indicator Programmatically to a View
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/6849072/show-activity-indicator-during-application-launch">Show activity indicator during application launch</a>  </p>
  </blockquote>
  
  
  
  <p>All,</p>
  
  <p>Inside my app delegate, I created an animated splash view that uses my Default.png. That all works OK but I cannot figure out how get my ActivityIndicator to display on top of the splash view. It's there just hidden by the splash view. Here is what I have and thanks:</p>
  
  <pre><code>- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  {
   //... data access stuff here ...
  
   self.window.rootViewController = self.tabBarController;
  [self.window makeKeyAndVisible];
  
  // ... more setup stuff here ...
  
  
  
  /****************************************************************************
   *
   *
   * Splash Screen for iPhone
   *
   ****************************************************************************/
  if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
  
  
      splashView = [[UIImageView alloc] initWithFrame:CGRectMake(0,0, 320, 480)];
      splashView.image = [UIImage imageNamed:@"Default.png"];
      [self.window addSubview:splashView];
      [self.window bringSubviewToFront:splashView];
      [UIView beginAnimations:nil context:nil];
      [UIView setAnimationDuration:0.5];
      [UIView setAnimationTransition:UIViewAnimationTransitionNone forView:self.window cache:YES];
      [UIView setAnimationDelegate:self];
      [UIView setAnimationDidStopSelector:@selector(startupAnimationDone:finished:context:)];
      splashView.alpha = 0.0;
      splashView.frame = CGRectMake(-60, -60, 440, 600);
      [UIView commitAnimations];
  
  
      //Create and add the Activity Indicator to splashView
      UIActivityIndicatorView *activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
      activityIndicator.alpha = 1.0;
      activityIndicator.center = CGPointMake(160, 240);
      activityIndicator.hidesWhenStopped = NO;
      [splashView addSubview:activityIndicator];
      [activityIndicator startAnimating];
  
  
  
  }
  
  
    return YES;
  }
  </code></pre>