title: iOS fading animation for multiple objects
body: <p>I have an iOS app in which every time the view is loaded, all of the objects in the view quickly fade in. </p>
  
  <p>In my code, I have a</p>
  
  <pre><code>- (void)fadeInEverything
  </code></pre>
  
  <p>function, and within this function, I call five different functions, with an NSTimer on each of them, so that the objects fade in sequentially, like this:</p>
  
  <pre><code>[self fadeInLabel];
  
  
  [NSTimer scheduledTimerWithTimeInterval:0.2
                                   target:self
                                 selector:@selector(fadeInTextField)
                                 userInfo:nil
                                  repeats:NO];
  [NSTimer scheduledTimerWithTimeInterval:0.4
                                   target:self
                                 selector:@selector(fadeInButton)
                                 userInfo:nil
                                  repeats:NO];
  [NSTimer scheduledTimerWithTimeInterval:0.6
                                   target:self
                                 selector:@selector(fadeInTextView)
                                 userInfo:nil
                                  repeats:NO];
  [NSTimer scheduledTimerWithTimeInterval:0.8
                                   target:self
                                 selector:@selector(fadeInFlipsideViewButton)
                                 userInfo:nil
                                  repeats:NO];
  </code></pre>
  
  <p>I have a function that looks like this for each object:</p>
  
  <pre><code>- (void)fadeInTextView
  {
      [resultView setAlpha:0];
  
      [UIView beginAnimations:nil context:NULL];
      [UIView setAnimationDuration:1];
  
      [resultView setAlpha:1];
  
      [UIView setAnimationDelegate:self];
      [UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)];
      [UIView commitAnimations];
  }
  </code></pre>
  
  <p>My question is, would there we a way to make one function that would take a parameter (the object) and fade it in, so I don't have to have five almost identical functions? It would save me a lot of space and clutter.</p>