title: How can I stop the Dispatch Queue
body: <p>I am using Dispatch Queue for loading the images but I don't know how to stop the queue if I don't want it to load all the images at some point.</p>
  
  <pre><code>- (void) loadImageInBackgroundArr1:(NSMutableArray *)urlAndTagReference {
      myQueue1 = dispatch_queue_create("com.razeware.imagegrabber.bgqueue", NULL);        
      for (int seriesCount = 0; seriesCount &lt;[seriesIDArr count]; seriesCount++) {
          for (int i = 0; i &lt; [urlAndTagReference count]; i++) {
              dispatch_async(myQueue1, ^(void) {
                  NSData *data0 = [[NSData alloc]initWithContentsOfURL:[NSURL URLWithString:[urlAndTagReference objectAtIndex:i]]];
                  UIImage *image = [[UIImage alloc]initWithData:data0];
                  dispatch_sync(dispatch_get_main_queue(), ^(void) {
  
                  for (UIView * view in [OD_ImagesScrollView subviews]) {
  
                      if ([view isKindOfClass:[UIView class]]) {
  
                          for (id btn in [view subviews]) {
                              if ([btn isKindOfClass:[UIButton class]]) {
  
                                                     UIButton *imagesBtn = (UIButton *)btn;
                          for (UIActivityIndicatorView *view in [imagesBtn subviews]) {
                              if ([view isKindOfClass:[UIActivityIndicatorView class]]) {
                                  if (imagesBtn.tag == seriesCount*100+100+i) {
                                      if (view.tag == seriesCount*100+100+i) {
                                          [imagesBtn setImage:image forState:UIControlStateNormal];
                                          [view stopAnimating];
                                          [view removeFromSuperview];
                                          view = nil;
                                          imagesBtn = nil;
                                      }
                                  }
                              }
                          }
                        }
                       }
                     }
                  }  
  
              });
  
              [image release];
              image = nil;
             [data0 release];
              data0 = nil;
          });
  
      }
  }
  
  }
  </code></pre>