0

Grand Central Dispatch

 dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{

    url_Img1=@"http://kiascenehai.pk/assets/uploads/event-images/50x50-thumb/";

    url_Img2=userObj.event_dpURL;

    url_Img_FULL = [url_Img1 stringByAppendingPathComponent:url_Img2];

    [arr addObject:url_Img_FULL];

    NSUserDefaults * userDefault = [NSUserDefaults standardUserDefaults];

    [userDefault setObject:userObj.event_dpURL forKey:@"dpURL"];

    [userDefault synchronize];

     result = [userDefault objectForKey:@"dpURL"];

     dispatch_async(dispatch_get_main_queue(), ^{

     [tableData addObjectsFromArray:retrievedData];

     [table reloadData];
     });

    });

}
Kanan Vora
  • 2,124
  • 1
  • 16
  • 26
  • You need to add your cellForRowAtIndexPath method code here – Retro Aug 01 '14 at 09:08
  • but row at index path can not be crated here ; as its another method like : -(void)repaint:(NSMutableArray *)retrievedData {} – user3094662 Aug 01 '14 at 09:13
  • show the cell for rowatindex method – Anbu.Karthik Aug 01 '14 at 09:24
  • -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { User *user = [tableData objectAtIndex:indexPath.row]; [[cell imageView] setImage:[UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:arr[indexPath.row]]]]]; }); }); return cell; } – user3094662 Aug 01 '14 at 09:28
  • Where is called your `dispatch_async`in your code ? Call your dataWithContentsOfURL: asynchronously, see : http://stackoverflow.com/a/15668366/2571566 – Kevin Hirsch Aug 01 '14 at 09:59
  • in the cell for row at index path dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ [[cell imageView] setImage:[UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:arr[indexPath.row]]]]]; dispatch_async(dispatch_get_main_queue(), ^{ SampleTableCell * cell = (SampleTableCell *)[tableView cellForRowAtIndexPath:indexPath]; // sets the image at the main thred of cell ::::: }); }); – user3094662 Aug 01 '14 at 10:02

1 Answers1

0

You can use AFNetworking Library for fast loading image from web.

You can get this library from https://github.com/AFNetworking/AFNetworking link