Block and GCD of 2014 studies

Source: Internet
Author: User

Grand Central Dispatch (GCD) is a solution for multi-core programming developed by Apple.

Block is a C-level syntax and runtime feature. Block is similar to the C function, but the block is more flexible than the C function, which is reflected in the stack memory, heap memory reference, and we can even pass a block as a parameter to other functions or block.

I will not write in detail, directly on the demo, I use the code to implement the layout, of course, the use of storyboard layout to Simple point

Get the picture to address:

Here is the layout:

The following is the event that implements the Click button

There are asynchronous requests, so you need the following methods

Below I implemented in GCD with GCD request data and block request picture, see Time to notice, if use block when the GCD comment out OK

The following block is used, but adding a block is to add a NSObject class, I am the definition of the LoadImage

The following is the definition of the NSObject class, but you have to write the code inside

Block and GCD of 2014 studies

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.