ios gcd加载图片

时间:2014-05-24 09:10:22   收藏:0   阅读:324

        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{

        NSString *urlString = @"http://img0.pconline.com.cn/pconline/1111/28/2601303_p2.jpg";

        NSURL *url = [NSURL URLWithString:urlString];

        NSData *sData = [NSData dataWithContentsOfURL:url];

        if(sData && sData.length > 0)

        {

            dispatch_async(dispatch_get_main_queue(), ^(void){

                NSLog(@">>>>>>>>>>main queue");

            });

        }

    });

 

1。GCD之dispatch queue

http://www.cnblogs.com/scorpiozj/archive/2011/07/25/2116459.html

2。iOS中GCD的魔力

http://blog.csdn.net/favormm/article/details/6453260

3。官方 ,内容真的很多

http://developer.apple.com/library/ios/#documentation/Performance/Reference/GCD_libdispatch_Ref/Reference/reference.html

http://developer.apple.com/library/ios/#documentation/General/Conceptual/ConcurrencyProgrammingGuide/OperationQueues/OperationQueues.html#//apple_ref/doc/uid/TP40008091-CH102-SW1

4.详解IOS开发应用之并发Dispatch Queues

http://mobile.51cto.com/iphone-283323.htm

5。斯坦福大学关于gcd的讲义

http://www.stanford.edu/class/cs193p/cgi-bin/drupal/system/files/lectures/Lecture 13_0.pdf

gcd其实就是牛逼简化版的多线程。gcd和block是亲兄弟,所以学习gcd前需要了解block,不知道也没事,看看代码就明白了。

ios gcd加载图片,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!