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