The block is similar to the function pointer in C. It is very convenient to transmit data in the Controller. Let's continue with the example in the previous chapter and transfer the data from Second to First. Here we use blocks to complete the process. It seems like the protocol, however, it is simpler than the Protocol. The Code is as follows: // FirstViewController-(void) viewDidLoad {[super viewDidLoad]; self. nameLable = [[[UILabel alloc] initWithFrame: CGRectMake (10, 10,300, 60)] autorelease]; self. nameLable. textAlignment = UITextAlignmentCenter; self. nameLable. font = [UIFont systemFontOfSize: 50]; self. nameLable. textColor = [UIColor blueColor]; [self. view addSubview: self. nameLable]; UIButton * button = [UIButton buttonWithType: UIButtonTypeRoundedRect]; button. frame = CGRectMake (130,170, 60, 40); [button setTitle: @ "Next" forState: UIControlStateNormal]; [button addTarget: self action: @ selector (pushNext :) forControlEvents: UIControlEventTouchUpInside]; [self. view addSubview: button];}-(void) pushNext :( id) sender {// initialize second SecondViewController * second = [[SecondViewController alloc] init]; // call the second block. send = ^ (NSString * str) {self. nameLable. text = str ;}; // pushed to [self. navigationController pushViewController: second animated: YES]; [second release];} objective-C 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 19 20 21 22 23 24 26 27 28 29 30 31 ////// //// // SecondViewController. h # import <UIKit/UIKit. h> typedef void (^ SendMessage) (NSString * str); // declaration block @ interface SecondViewController: UIViewController <UITextFieldDelegate> @ property (nonatomic, copy) SendMessage send; // declare a block type attribute @ end // SecondViewController. m-(void) viewDidLoad {[super viewDidLoad]; UITextField * textFd = [[UITextField alloc] initWithFrame: CGRectMake (10, 10,300,150)]; textFd. borderStyle = UITextBorderStyleRoundedRect; textFd. delegate = self; textFd. tag = 100; [self. view addSubview: textFd]; [textFd release];}-(BOOL) textFieldShouldReturn :( UITextField *) textField {[textField resignFirstResponder]; // first, pass the real parameter if (self. send) {self. send (textField. text);} return YES ;}