I'm using async task for fetching images from Web on my main view controller. When user click on any cell on my table view I would like to suspend the Async tasks and go to another view.How Can I do this? Also I need to continue the tasks when user comes back to the Main view. My Code
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{
UIImage *imagefromWeb = [UIImage imageWithData:[NSData dataWithContentsOfURL:[IconArray objectAtIndex:indexPath.row]]];
CGSize newSize= CGSizeMake(45.0,45.0);
UIGraphicsBeginImageContextWithOptions(newSize, NO, 0.0);
[imagefromWeb drawInRect:CGRectMake(0, 0, newSize.width, newSize.height)];
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
dispatch_async(dispatch_get_main_queue(), ^{
cell.imageView.image=newImage;
[cell setNeedsLayout];
MAKE_IMAGE_CURVED(cell.imageView)
});
});