title: iPhone loading view "slide effect"
body: <p>I would to achieve that when you request something in my app (like a button pressed or whatever) I would like it to appear a small rectangle that says "loading.." and when the loading is completed it disappear with a "slide up effect". I've made a simple mockups for describing well what I'm trying to achieve. Do you have any hint for me? Thanks.</p>
  
  <p><img src="https://i.stack.imgur.com/ZTBVO.png" alt="enter image description here"></p>
  
  <p>NOTE: <strong>I don't want pull to refresh effect (the loading view appears without the screen scrolling, it appears for example when you send a comment)</strong></p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>I've tried the Cirrostratus code:</p>
  
  <pre><code>- (IBAction)displayLoadingScreen:(id)sender
  {
      NSLog(@"pressed");
      UIView *loadingView = [[UIView alloc] init];
      loadingView.frame = CGRectMake(0,-40,320,40);
      [loadingView setBackgroundColor:[UIColor blueColor]];
      [self.view addSubview:loadingView];
      //animate in within some method called when loading starts
      [UIView animateWithDuration:1.0
                       animations:^{ 
                           loadingView.frame = CGRectMake(0,0,320,40);
                       } 
                       completion:^(BOOL finished) {
                       }];
      for (int i = 0; i &lt; 10000; i++) {
          NSLog(@"%d", i);
      }
      //animate out within some method called when loading ends
      [UIView animateWithDuration:1.0
                       animations:^{ 
                           loadingView.frame = CGRectMake(0,-40,320,40);
                       } 
                       completion:^(BOOL finished){
  
  
                       }];
  }
  </code></pre>
  
  <p>Why the loading view slide in <strong>after</strong> the for loop? If you try it, before it prints the for loop and after executes the two animations. Ideas?</p>
  
  <p><strong>UPDATE 2</strong></p>
  
  <pre><code>- (void)stopLoading {
      [UIView animateWithDuration:1.0
                       animations:^{ 
                           loadingView.frame = CGRectMake(0,-40,320,40);
                       } 
                       completion:^(BOOL finished){
                       }];
  }
  
  - (void)startLoading {
      loadingView.frame = CGRectMake(0,-40,320,40);
      [loadingView setBackgroundColor:[UIColor blueColor]];
      [self.view addSubview:loadingView];
      //animate in within some method called when loading starts
      [UIView animateWithDuration:1.0
                       animations:^{ 
                           loadingView.frame = CGRectMake(0,0,320,40);
                       } 
                       completion:^(BOOL finished) {
                       }];
      sleep(5);
      [self stopLoading];
  }
  
  - (IBAction)displayLoadingScreen:(id)sender
  {
      NSLog(@"button pressed");
      [self startLoading];
  }
  </code></pre>