title: access the control inside the synchronous block in xcode 5.0 iPhone
body: <p>I am new to blocks programming.I am trying to download an image and display it on an image view whose property i have already made in my .h file.as far as i know the class property  can only be accessed  in the form of getter/setter inside the block.So i have created an imageView "imgVw" in viewDidload method and am currently unable to access it inside the block using self. Please find below my code.</p>
  
  <pre><code>/*dispatch the queue asynchronously  for non ui related tasks image downloading*/
  
      void(^downloadimage)(void)=^{
  
          dispatch_queue_t concurrentqueue=dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
  
          dispatch_async(concurrentqueue,^void{
  
              __block UIImage *image=nil;
  
              dispatch_sync(concurrentqueue, ^{
              //download image
                  NSString *stringUrl=@"http://www.avajava.com/images/avajavalogo.jpg";
                  NSURL *url=[NSURL URLWithString:stringUrl];
                  NSURLRequest *request=[NSURLRequest requestWithURL:url];
  
                  NSError *error=nil;
                  NSData *data=[NSURLConnection sendSynchronousRequest:request returningResponse:nil error:&amp;error];
                  if(error== nil &amp;&amp; data !=nil)
                  {
                      image=[UIImage imageWithData:data];
                  }
                  else if (error!=nil)
                  {
                      NSLog(@"Error %@",[error description]);
  
                  }
                  else
                  {
                      NSLog(@"No data could be downloaded");
                  }
  
              });
              dispatch_sync(dispatch_get_main_queue(), ^{
  
                  /*show the image on main queue*/
                  if(image!=nil)
                  {
                  **/*set image downloaded to imageView imgVw*/
                  [[self imgVw] setImage:image];**
  
                  }
                  else
                  {
                      NSLog(@"image is not downloaded");
                  }
  
              });
          });
      };
  </code></pre>