title: ScrollView addSubview: very slow
body: <p>I am using a scrollview to display a viewcontrollers view. if the user reaches the end of the cached views my method reloads the new views. My NSLogs say that the method is finished but it takes additional 5 seconds to display the view.
  I think that the [scrollView addSubview:vc.view] is very very slow but I found nothing to improve it.</p>
  
  <p>the whole method gets called in -(void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView  </p>
  
  <pre><code> scrollView.userInteractionEnabled = NO;
  
      UIActivityIndicatorView *activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
      [activityIndicator setFrame:CGRectMake((320.f*index)+135.f, 151, 50, 50)];
      [activityIndicator setHidesWhenStopped:YES];
      [activityIndicator startAnimating];
  
      [scrollView addSubview:activityIndicator];
  
      MBBAppDelegate *delegate = (MBBAppDelegate *)[UIApplication sharedApplication].delegate;
  
      [delegate fetchDealsWithFilter:dealFilter fromIndex:index toIndex:(index+3) onSuccess:^(id object){
  
          MBBDealList *list = object;
  
          int i = 0;
  
          ProductDetailViewController *vc;
  
          for (MBBDeal *deal in [list deals]) {
  
              NSLog(@"start %i",i);
              int indexInArray = i;//[list.deals indexOfObject:deal];
  
              if (indexInArray+index &gt;= numDeals) {
                  return;
              }
  
              vc = [[ProductDetailViewController alloc] init];
  
              //fetch the deal and insert
              vc.numberOfDeals = numDeals;
              vc.dealIndex = index+1+indexInArray;
              vc.dealFilter = dealFilter;
              vc.deal = deal;
  
              vc.view.frame = CGRectMake(320.f*(index+indexInArray), 0.f, 320.f, 436.f);
  
              [scrollView addSubview:vc.view];
  
              [productDetailViewControllers insertObject:vc atIndex:(index+indexInArray)];
  
              i++;
          }
          [activityIndicator stopAnimating];
          scrollView.userInteractionEnabled = YES;
  
      }];
  
  }
  </code></pre>
  
  <p>Does anyone know how I can improve my method?</p>