title: Activity Indicator while loading images inside UIScrollView
body: <p>I have UIScrollView that contains images from the server.</p>
  
  <p>I should put Activity Indicator while the image is currently loading.</p>
  
  <p>UIScrollView contains dynamic number of images from the server.</p>
  
  <p>May I know how can I add activity indicators on each page while the image is loading and remove once image is loaded.</p>
  
  <p>Here's my code to retrieve images:</p>
  
  <pre><code>NSDictionary *items = [NSDictionary dictionaryWithObject:dictInfo forKey:@"images"];
  imageList = [items objectForKey:@"images"];
  NSArray *img = [imageList objectForKey:@"list"];
  NSInteger imgCount = [img count];
  buttonArray = [[NSMutableArray alloc] init];
  
  for (int i=0; i&lt;imgCount; i++) {
      NSDictionary *imgDict = [img objectAtIndex:i];
      // REQUEST FOR IMAGES
      NSString *imgPath = [imgDict objectForKey:@"image_slot"];
      NSString *imgURL = imgPath;
  
      __block ASIHTTPRequest *requestImage = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:imgURL]];
      [requestImage setCompletionBlock:^{
          imgView = [UIImage imageWithData:[requestImage responseData]];
  
          if (imgURL.length) {
              [pendingRequests removeObjectForKey:imgURL];
          }
  
          scrollView.userInteractionEnabled = YES;
          scrollView.exclusiveTouch = YES;
          scrollView.canCancelContentTouches = YES;
          scrollView.delaysContentTouches = YES;
          scrollView.bounces = NO;
  
          CGRect frame;
          frame.origin.x = self.scrollView.frame.size.width * i;
          frame.origin.y = 0;
          frame.size = self.scrollView.frame.size;
  
          SWTUIButton *imgBtn = [[SWTUIButton alloc] initWithFrame:frame];
          imgBtn.url = [requestImage.userInfo objectForKey:@"rURL"];
          [imgBtn setImage:imgView forState:UIControlStateNormal];
          imgBtn.backgroundColor = [UIColor clearColor];
          [imgBtn addTarget:self action:@selector(buttonpushed:) forControlEvents:UIControlEventTouchUpInside];
          [scrollView addSubview:imgBtn];
  
          [buttonArray addObject:imgBtn];
  
          [imgBtn release];
  
          self.scrollView.contentSize = CGSizeMake(self.scrollView.frame.size.width * img.count, self.scrollView.frame.size.height);
      }];
  </code></pre>