iOS 之 后台下载,前台显示模式,双 block

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
    //耗时的操作
    NSURL *url = [NSURL URLWithString:@""];
    NSData *data = [[[NSData alloc] initWithContentsOfURL:url autorelease];
    UIImage *image = [[[UIImage alloc] initWithData:data] autorelease];
    
    dispatch_async(dispatch_get_main_queue(),^{ 
        //更新界面 
        _imageView.image = image;
    }); 
});    
原文地址:https://www.cnblogs.com/SimonGao/p/5070980.html