iOS gcd loading pictures

Source: Internet
Author: User

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's dispatch queue

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

2. The magic of GCD in iOS

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

3. Officially, it's a lot of content.

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. Detailed iOS Development application concurrency dispatch Queues

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

5. Stanford University's lecture notes on GCD

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

GCD is actually a simple version of multithreading. GCD and block are brothers, so learn gcd before need to understand block, do not know also nothing, look at the code to understand.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.