Asyncronous image loading in uitableview cell
<p>I am new in iPhone programming. I want to load images in to the UITableView. My images came from the web. I know that I must use <code>ASIHttp Request</code> and then load images to the UITableview. But if I do that then until its load images UITableview hang.
If I use asynchronous image loading block then each time when <code>Cell==nil</code> or Reuse the request maid, that I doesn't want to do.</p>

<p>Following line of code I am using in Tableview <code>cellForRowAtIndexpath</code>.</p>

<pre><code>    -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    {

        static NSString *CellIdentifier = @"CellIdentifier";

        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
        UIImageView *imgViewCellBg;

        if (cell == nil) {
            cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
            cell.accessoryType=UITableViewCellAccessoryNone;



                   imgViewCellBg = [[UIImageView alloc] initWithFrame:CGRectMake(0,0,320,151)];
                   imgViewCellBg.userInteractionEnabled = NO;
                     imgViewCellBg.backgroundColor = [UIColor whiteColor];
                   imgViewCellBg.tag = 10000;
                   [cell.contentView addSubview:imgViewCellBg];
                   [imgViewCellBg release];

         }
       else{
                   imgViewCellBg = (UIImageView *)[cell.contentView viewWithTag:10000];
            }


     //-------------------------------- For the image Downloding And Displaying ------
            __block ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:(MY Url)]];
            [request setCompletionBlock:^{
                // NSLog(@"Image downloaded.");
                NSData *data = [request responseData];
                UIImage *imageCountry = [[UIImage alloc] initWithData:data];

                [imgViewCellBg setImage:imageCountry];
                imageCountry = Nil;

            }];
            [request setFailedBlock:^{
                NSError *error = [request error];
                NSLog(@"Error downloading image: %@", error.localizedDescription);
            }];
            [request startAsynchronous];
            //-----------------------------------------------------------------


 return cell;
</code></pre>
