Block for IOS development and iosblock
Block for IOS development 1. What is block? The role of block
Common UI development and network functions implement callback. The button event processing method is the callback method.
(1) The target action button is passed in by a method.
(2) input the pointer self in the table view and call back the method in the View Controller.
(3) block statement block, which solves the callback. It is understood as an "anonymous function" and is defined in the method.
2. Basic use (syntax) of block to define block Variables
Void (^ block )();
Define block statement Blocks
Block = ^ void (){
NSLog (@ "I am block ");
};
// Execute
Block ();
Block parameters and return values
Int (^ myAdd) (int x, int y) = ^ int (int x, int y)
{
Return x + y;
};
Int s = myAdd (3, 5 );
NSLog (@ "s = % d", s );
3. block application in Development (OC, UI, Network)
BlockUseDemo
Http:// I .cnblogs.com/Files.aspx